/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 30ms 4.172 MiB
#3 Accepted 27ms 4.496 MiB
#4 Accepted 31ms 4.27 MiB
#5 Accepted 27ms 4.27 MiB
#6 Accepted 26ms 4.27 MiB

Code

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define loop(i, n) for (ll i = 0; i < (n); i++)
#define iloop(i, init, n) for (ll i = (init); i < (n); i++)
#define autoll(stl, itr) for (auto itr : stl)
#define autol(stl ) for (auto itr : stl)
#define pb push_back
#define vll vector<long long>
#define vvll vector<vector<long long>>
#define vch vector<char>
#define vvch vector<vector<char>>
#define sortv(a) sort(a.begin(), a.end())
#define sortvr(a) sort(a.rbegin(), a.rend())
#define reversev(a) reverse(a.begin(), a.end())
#define sumv(a) accumulate(a.begin(),a.end(),0LL)
#define pll pair<long long, long long>
#define vpll vector<pair<long long, long long>>
#define vpch vector<pair<char, char>>
#define mll map<ll, ll>
#define mchll map<ch, ll>
#define sll set<long long>
#define msll multiset<long long>
#define mem(a, b) memset(a, b, sizeof(a))
#define SIZE(arr) sizeof(arr) / sizeof(arr[0])
#define YO cout<<"YO\n"  
#define YES cout<<"YES\n"  
#define Yes cout<<"Yes\n" 
#define yes cout<<"yes\n"
#define NO cout<<"NO\n"  
#define No cout<<"No\n"  
#define no cout<<"no\n"
#define out cout <<
#define nl << "\n"
#define spc << " "
#define space << " " <<
#define oo <<
#define pie 3.141592653589793238462643383279502884197 //acos(-1)
#define printv(stl) for(auto itr: stl){cout<<itr<<" ";}cout<<"\n";
#define printvv(stl) for(auto itr: stl){for(auto it: itr){cout<<it<<" ";}cout<<"\n";}


// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template<typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// template<typename T>struct OrderedMultiset {
//     int id;
//     ordered_set<pair<T, int>> st;
//     OrderedMultiset() {id = 0;}
//     void insert(T val) {st.insert({val, id++});}
//     void erase(T val) {st.erase(st.lower_bound({val, 0}));} 
//     int order_of_key(T val) {return st.order_of_key({val, 0});}
//     T find_by_order(int val) { pair<T, int> p = *st.find_by_order(val); return p.first;}
//     typename ordered_set<pair<T,int>>::iterator lower_bound(T val) {return st.lower_bound({val, 0});}
//     typename ordered_set<pair<T, int>>::iterator upper_bound(T val) {return st.upper_bound({val, id});}
//     int size() {return st.size();}
//     void clear() { st = ordered_set<pair<T, int>>();}
// };
//// find_by_order, order_of_key



// vector<bool> isPrimeArr(1000009,false); // is compos
// void sieve(ll n) {
//     n++;
//     isPrimeArr[0] = true;
//     isPrimeArr[1] = true;
//     for(ll p=2; p*p<=n; p++) {
//         if(isPrimeArr[p]==false) {
//             for(ll i=p*p; i<=n; i+=p) if(!isPrimeArr[i]) isPrimeArr[i]=true;
//         }
//     }
// }


//// a^-1 % m = a^(m-1) % m ;  a and m coprime, m prime; 
const ll M=1e9 + 7;
ll poww(ll a, ll b){
    ll ans=1;
    while(b>0){
        if(b&1LL){
            ans=(ans*a)%M;
        }
        a=(a*a)%M;
        b>>=1;
    }
    return ans%M;
}


ll sum1ton(ll n){
    if(n%2){
        return n*((n+1)/2);
    } 
    return (n/2)*(n+1);
}
ll nc2(ll n){
    if(n<2)return 0;
    if(n%2){
        return n*((n-1)/2);
    } 
    return (n/2)*(n-1);
}
ll lcm(ll a, ll b){
    return (a*b)/__gcd(a,b);
}
ll sumOfDigits(ll n){
    ll ans=0;
    while (n!=0){
        ans+=(n%10);
        n/=10;
    }
    return ans;
}
bool isPrime(ll n){
    if(n==1)return false;
    for(ll i=2; i*i<=n; i++){
        if(n%i==0)return false;
    }
    return true;
}
bool isPowerOfTwo(ll x){
    return x && (!(x & (x - 1)));
}


// bool cmp(pll a, pll b){
//     return a.second<b.second;
// }

//// A^(-1) % m = A^(m-2) % m ; A and m is coprime, m is prime;
// const ll mod = 1e9 +7;
// ll factorial(ll n){
//     if(n==0)return 1LL;
//     ll ans=1;
//     iloop(i,1,n+1){
//         ans=(ans*i)%mod;
//     }
//     return ans%mod;
// }

void SOLVE() {
    ll n;
    cin>>n;
    vll v(n);
    mll mp;
    loop(i,n){
        cin>>v[i];
        mp[v[i]]++;
    }
    autol(mp){
        if(itr.second==1){
            out itr.first nl;
            break;
        }
    }
}

// string r = s1.substr(3, 2);
// s.find(sb)!=string::npos

/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // sieve(1000001);
    
    ll TEST_CASE = 1;
    // cin >> TEST_CASE;
    while (TEST_CASE--){
        SOLVE();
    }
}

Information

Submit By
Type
Submission
Problem
P1095 Uncovering the Lone Heart
Contest
Brain Booster #6
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-03 15:36:05
Judged At
2024-10-03 15:36:05
Judged By
Score
100
Total Time
31ms
Peak Memory
4.496 MiB