Cặp nhóm

Xem dạng PDF


Bình luận

Hãy đọc nội quy trước khi bình luận.



  • 1
    Artemis18  đã bình luận lúc 9, Tháng 6, 2026, 8:45

    include<bits/stdc++.h>

    define ll long long

    using namespace std; ll n,i; ll a[100005]; map<ll,ll> ts; map<ll,bool> daIn; int main() { iosbase::syncwith_stdio(0); cin.tie(0);cout.tie(0); freopen("a.inp","r",stdin); freopen("a.out","w",stdout); cin>>n; for(i=1;i<=n;i++) { cin>>a[i]; ts[a[i]]++; } for(i=1;i<=n;i++) { ll x=a[i]; if(ts[x]>0) { cout<<x<<" "<<ts[x]<<"\n"; ts[x]=0; } } return 0; }


  • -1
    khactrung1308  đã bình luận lúc 9, Tháng 6, 2026, 8:33

    include<bits/stdc++.h>

    using namespace std; map<int,int> m; int i,n,x,a[10000007],d[10000000]; int main() { iosbase::syncwith_stdio(0); cin.tie(0);cout.tie(0); freopen("hello.inp","r",stdin); freopen("hello.out","w",stdout); cin>>n; for(i=1;i<=n;i++) { cin>>a[i]; d[a[i]]++; } for(i=1;i<=n;i++) { if(d[a[i]]>0) { cout<<a[i]<<" "<<d[a[i]]<<'\n'; d[a[i]]=0; }

    }
    

    }


  • -1
    khactrung1308  đã bình luận lúc 27, Tháng 4, 2026, 17:36

    hello