Submission #1115584

#TimeUsernameProblemLanguageResultExecution timeMemory
1115584LeonidCukInfinite Race (EGOI24_infiniterace2)C++17
34 / 100
45 ms2384 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...