제출 #1241043

#제출 시각아이디문제언어결과실행 시간메모리
1241043MarwenElarbiInfinite Race (EGOI24_infiniterace2)C++20
29 / 100
44 ms18244 KiB
#include <bits/stdc++.h> //#include "robot.h" using namespace std; #define fi first #define se second #define pb push_back const int nax = 5e5+5; vector<int> tab[nax]; int main() { int n; cin>>n; int q; cin>>q; while(q--){ int c; cin>>c; tab[abs(c)].push_back((c>0 ? 1 : -1)); } int ans=0; for (int i = 1; i <= n; ++i) { int lst=0; for(int j = 0; j<tab[i].size() ; j++){ if(tab[i][j]>0) lst++; else{ if(lst) lst--; while(j<tab[i].size()&&tab[i][j]<0){ j++; } j--; } ans=max(ans,lst); } } cout <<ans-1<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...