Submission #1129425

#TimeUsernameProblemLanguageResultExecution timeMemory
1129425MatbubbleInfinite Race (EGOI24_infiniterace2)C++20
0 / 100
179 ms31652 KiB
#include <iostream> #include <iomanip> #include <string> #include <math.h> #include <algorithm> #include <cstring> #include <numeric> #include <vector> #include <bitset> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <unordered_map> #include <unordered_set> using namespace std; #define dbg(x) cerr<<#x<<": "<<x<<"\n"; /* Seventh Heaven INOHA */ void solve(){ int n, q; cin>>n>>q; map<int, int>freq; map<int, vector<int>>ans; int aux=0; for(int i=0 ; i<q ; i++){ int curr; cin>>curr; if(curr<0){ freq[curr]=0; }else{ ans[curr].push_back(freq[curr]); freq[curr]++; } } for(auto it:ans){ vector<int>v=it.second; int curr=0; for(int i=0 ; i<(int)v.size()-1 ; i++){ if(v[i]>v[i+1]) curr+=v[i]; } aux=max(aux, curr+v.back()); } cout<<aux<<"\n"; } int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); 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...