Submission #1115586

#TimeUsernameProblemLanguageResultExecution timeMemory
1115586LeonidCukInfinite Race (EGOI24_infiniterace2)C++17
100 / 100
49 ms2532 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n,m,a; cin>>n>>m; vector<int>v(n); int cnt=0; for(int i=0;i<m;i++) { cin>>a; if(a>0) { v[a]=max(cnt+1,v[a]+1); if(v[a]==cnt+2) { cnt++; } } else { v[-a]=cnt; } } cout<<cnt; 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...