Submission #777003

#TimeUsernameProblemLanguageResultExecution timeMemory
777003Dan4LifeSequence (APIO23_sequence)C++17
Compilation error
0 ms0 KiB
#include "sequence.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; template<class T> using Tree = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; #define sz(a) (int)a.size() #define fi first #define se second #define pb push_back vector<pair<int,int>> v[500000]; Tree<pair<int,int>> S; map<int,int> tot; int n; int sequence(int N, vector<int> a) { n = N; int ans = 1; for(int i = 0; i < n; i++){ int j = i; while(i<n-1 and a[i]==a[i+1]) i++; v[a[i]].pb({j,i-j+1}); ans = max(ans, i-j+1); } for(int i = 1; i <= n; i++){ if(sz(v[i])<2)continue; int y = v[i][0].se+v[i][1].se; int z = v[i][1].fi-(v[i][0].fi+v[i][0].se); int x = v[i][0].fi + n-1-(v[i][1].fi+v[i][1].se)-1); if(x>=z-y) ans = max(ans, y); } return ans; }

Compilation message (stderr)

sequence.cpp: In function 'int sequence(int, std::vector<int>)':
sequence.cpp:27:53: error: expected ',' or ';' before ')' token
   27 |   int x = v[i][0].fi + n-1-(v[i][1].fi+v[i][1].se)-1);
      |                                                     ^