Submission #1128544

#TimeUsernameProblemLanguageResultExecution timeMemory
1128544Ak_16Infinite Race (EGOI24_infiniterace2)C++17
0 / 100
41 ms3932 KiB
#include <iostream> using namespace std; int main() { int n,q; int a[300000]; int mx[300000] = {0}; cin>>n; cin>>q; int cnt[300000] = {0}; for(int i=1; i<=q; i++){cin>>a[i];} for(int i=q; i>=1; i--){ if(a[i]>0){cnt[a[i]] ++; mx[a[i]] = max(mx[a[i]], cnt[a[i]]);} else {cnt[-a[i]]--;} } int ok=0; for(int i=1; i<n; i++){ok = max(ok, mx[i] -1);} cout<<ok; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...