Submission #1189064

#TimeUsernameProblemLanguageResultExecution timeMemory
1189064anotherInfinite Race (EGOI24_infiniterace2)C++20
100 / 100
65 ms9796 KiB
#include <bits/stdc++.h> #define endl '\n' using namespace std; #define ll long long #define ld long double #define pll pair<ll,ll> #define pb push_back ll T=1,n,nq,x,y,ind,t,dp[5000099][3],k,mx,rs=0,c,pr,lft,a[2000009]; string s; //map<ll,ll>ma; void slv() { cin>>n>>nq; pr=0;lft=0;rs=0; ll t2=0,t1=0; set<ll>bf; while(nq--) { cin>>x; if(x<0) { x=abs(x); bf.erase(x); } else { if(bf.count(x)) { rs++; bf.clear(); bf.insert(x); } else bf.insert(x); } } cout<<rs<<endl; } int main() { //freopen("feast.in", "r", stdin); //freopen("feast.out", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); //cin>>T; while(T--) slv(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...