1 solutions

  • 0
    @ 2026-11-15 12:29:54

    C++ :

    #include <bits/stdc++.h>
    #define N 100005
    using namespace std;
    int a[N];
    int main(){
        int n,m,x;
        cin >> n >> m;
        
        for (int i = 1;i<=m;i++){
            cin >> x;
            a[x] ++;
        }
        
        for (int i =1 ;i<=n;i++){
            if (a[i] > 1) 
    			cout << i << " " << a[i] << endl;
        }
        
        return 0;
    }
    
    • 1

    Information

    ID
    182
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By