Tacos de bilhar

Problem Link

Solution by Mr.Olimpia100 pts

Code / Notes

#include <bits/stdc++.h>
using namespace std;

int main(){
    int N;
    cin >> N;
    int ans=0;
    vector<int> tacos(1E6, 0);
    for(int i=0; i<N; i++){
        int x;
        cin >> x;
        if(tacos[x]==0){
            tacos[x]++;
            ans=ans+2;
        }
        else if(tacos[x]==1){
            tacos[x]--;
        }
    }
    cout << ans << endl;
}

Last updated 1 week ago


« Back to problem