【題解】Codeforces 1438B. Valerii Against Everyone

【題目敘述】http://codeforces.com/contest/1438/problem/B

#include <iostream>
#include <map>
using namespace std;
 
int t, n, a;
 
int main() {
    cin >> t;
    while (t--){
        cin >> n;
        map <int, int> mp;
        bool flag = false;
        for (int i = 0; i < n; i++){
            cin >> a;
            if (mp[a]) flag = true;
            mp[a]++;
        }
        if (flag) cout << "YES\n";
        else cout << "NO\n";
    }
}
分享本文 Share with friends