QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#270537 | #5543. The Only Mode | yuto1115# | AC ✓ | 97ms | 47824kb | C++23 | 2.9kb | 2023-12-01 00:18:54 | 2023-12-01 00:18:55 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200010;
int a[N];
struct SegTree{
vector<pair<int,int> >t[N*4];
vector<int>used;
void upd(int v,int l,int r,int L,int R,int y,int i){
if (l>R || r<L) return;
if (l>=L && r<=R){
if (t[v].empty() || t[v].back().first < y){
used.push_back(v);
t[v].push_back({y,i});
// cout<<"SEG "<<l<<" "<<r<<" "<<y<<" "<<i<<endl;
}
return;
}
int m=(l+r)/2;
upd(v+v,l,m,L,R,y,i);
upd(v+v+1,m+1,r,L,R,y,i);
}
void get(int v,int l,int r,int pos,int x,int &ans,int ind){
if (!t[v].empty() && t[v].back().first>x){
pair<int,int>fnd={x,N};
auto it=upper_bound(t[v].begin(),t[v].end(),fnd);
ans=max(ans,ind-it->second);
}
if (l==r) return;
int m=(l+r)/2;
if (pos<=m){
get(v+v,l,m,pos,x,ans,ind);
} else {
get(v+v+1,m+1,r,pos,x,ans,ind);
}
}
void clear(){
for (int i:used){
t[i].clear();
}
used.clear();
}
};
SegTree T;
int cnt[N][4];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;cin>>n;
for (int i=1;i<=n;i++){
cin>>a[i];
//a[i]=min(3,rand()%10);
for (int j=0;j<4;j++){
cnt[i][j]=cnt[i-1][j];
}
cnt[i][a[i]]++;
}
vector<int>res(4,0);
for (int el=0;el<4;el++){
int ans=0;
for (int i=1;i<=n;i++){
int mx=0;
for (int j=0;j<4;j++){
if (j==el) continue;
mx=max(mx,cnt[i][j]);
}
if (mx<cnt[i][el]) ans=i;
}
for (int other=0;other<4;other++){
if (other==el) continue;
// cout<<el<<" "<<other<<endl;
vector<int>val;
for (int i=0;i<4;i++){
if (i==el || i==other) continue;
val.push_back(i);
}
vector<vector<pair<pair<int,int>,int> > >U(n*2+2);
vector<vector<pair<pair<int,int>,int> > >G(n*2+2);
for (int i=1;i<=n;i++){
if (i==n || a[i+1]==other) G[cnt[i][el]-cnt[i][other]+n].push_back({{cnt[i][val[0]]-cnt[i][el],cnt[i][val[1]]-cnt[i][el]},i});
U[cnt[i][el]-cnt[i][other]+n+1].push_back({{cnt[i][val[0]]-cnt[i][el],cnt[i][val[1]]-cnt[i][el]},i});
}
for (int it=0;it<n*2+2;it++){
// if (it%1000==0) cout<<it<<endl;
if (G[it].empty() || U[it].empty()) continue;
int j=0;
for (auto cur:G[it]){
// if (el==0 && other==2) cout<<"g = "<<it<<" "<<cur.first.first<<" "<<cur.first.second<<" "<<cur.second<<endl;
while (j<U[it].size() && cur.second-U[it][j].second>ans){
T.upd(1,1,n*2,1,U[it][j].first.first+n-1,U[it][j].first.second,U[it][j].second);
j++;
}
T.get(1,1,n*2,cur.first.first+n,cur.first.second,ans,cur.second);
// if (el==0 && other==2) cout<<"ind "<<el<<" "<<other<<" "<<ind<<" "<<cur.second<<endl;
}
T.clear();
}
}
res[el]=ans;
}
for (int i=0;i<4;i++){
cout<<res[i]<<" ";
}
cout<<endl;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 23044kb
input:
7 1 2 2 0 3 0 3
output:
4 1 5 3
result:
ok single line: '4 1 5 3 '
Test #2:
score: 0
Accepted
time: 0ms
memory: 24080kb
input:
12 2 0 1 0 2 1 1 0 2 3 3 3
output:
4 9 1 9
result:
ok single line: '4 9 1 9 '
Test #3:
score: 0
Accepted
time: 0ms
memory: 23388kb
input:
2 0 2
output:
1 0 1 0
result:
ok single line: '1 0 1 0 '
Test #4:
score: 0
Accepted
time: 0ms
memory: 24204kb
input:
12 3 0 2 2 1 0 2 1 3 3 2 3
output:
1 5 11 8
result:
ok single line: '1 5 11 8 '
Test #5:
score: 0
Accepted
time: 4ms
memory: 22852kb
input:
1 1
output:
0 1 0 0
result:
ok single line: '0 1 0 0 '
Test #6:
score: 0
Accepted
time: 3ms
memory: 23104kb
input:
4207 3 1 0 3 2 0 3 1 1 1 1 3 0 1 1 0 2 2 3 0 1 1 0 1 0 2 0 1 0 0 3 3 1 0 1 3 3 0 2 0 2 0 1 0 2 3 2 3 0 0 0 0 1 2 1 2 0 2 2 0 3 3 2 2 0 2 2 0 3 0 1 3 1 1 0 2 3 0 1 2 1 2 0 0 1 1 0 3 3 2 0 2 1 3 0 1 0 3 0 0 0 2 2 2 0 1 1 0 3 1 1 3 3 2 2 1 3 3 1 3 2 0 2 3 2 2 1 0 2 3 0 1 0 0 1 1 1 3 3 1 3 3 3 0 0 0 3 2...
output:
2330 1520 4207 1359
result:
ok single line: '2330 1520 4207 1359 '
Test #7:
score: 0
Accepted
time: 43ms
memory: 36564kb
input:
89925 0 0 0 3 0 3 0 2 3 2 3 1 0 0 0 2 2 1 3 3 0 0 1 0 0 3 0 1 0 0 1 1 0 0 1 2 1 3 1 2 1 2 2 1 0 2 2 3 0 0 1 0 2 3 2 3 0 0 1 0 0 1 2 1 3 0 0 0 2 1 1 0 1 3 2 2 0 0 2 3 2 3 3 1 3 3 0 2 0 2 2 0 2 1 3 0 1 1 0 0 1 0 3 1 2 2 2 0 2 0 2 3 2 0 0 2 3 3 1 0 1 2 2 2 1 2 0 0 3 2 3 0 1 1 3 3 0 0 0 3 0 2 0 0 2 3 1 ...
output:
89925 49888 75725 38162
result:
ok single line: '89925 49888 75725 38162 '
Test #8:
score: 0
Accepted
time: 34ms
memory: 32412kb
input:
64937 1 1 0 2 1 1 3 1 1 1 2 0 3 1 1 2 1 2 2 1 0 2 1 1 1 1 1 0 3 1 0 2 1 0 0 0 0 2 1 2 1 2 2 1 2 3 2 1 2 1 3 0 1 3 0 0 1 3 1 2 2 2 0 3 3 1 3 0 3 3 2 0 1 1 2 0 3 3 3 2 1 0 1 0 1 3 0 0 2 1 0 3 3 1 2 3 2 1 1 0 0 3 1 1 2 1 0 2 1 0 0 1 1 3 0 1 2 1 3 2 0 3 1 2 1 2 0 0 0 1 1 2 3 3 2 1 1 1 2 1 3 1 2 2 2 0 1 ...
output:
64937 61901 51387 63870
result:
ok single line: '64937 61901 51387 63870 '
Test #9:
score: 0
Accepted
time: 43ms
memory: 34052kb
input:
73423 1 2 2 0 0 0 0 2 1 2 1 2 1 3 1 3 3 0 1 2 2 0 0 0 3 2 1 1 0 3 0 2 1 3 1 1 2 3 0 1 2 1 0 0 0 3 3 0 3 2 3 3 1 1 3 2 0 0 0 3 2 0 0 2 3 3 3 3 3 2 3 2 2 2 3 3 0 1 1 2 2 2 1 2 2 1 1 2 1 2 2 3 0 3 0 2 2 2 1 2 1 1 2 3 0 1 3 2 0 3 3 3 0 2 2 2 3 1 0 1 0 1 1 3 0 0 2 1 1 3 1 3 3 2 0 2 2 1 1 0 1 0 2 3 1 2 3 ...
output:
36577 18616 60210 73423
result:
ok single line: '36577 18616 60210 73423 '
Test #10:
score: 0
Accepted
time: 39ms
memory: 35120kb
input:
82517 2 1 1 0 2 0 3 1 3 1 3 3 2 2 3 0 3 2 2 0 2 1 0 2 2 3 2 0 1 0 1 2 2 1 1 1 3 2 2 0 1 0 0 3 3 1 1 0 3 1 3 1 2 3 3 3 3 3 2 1 3 1 3 0 2 0 2 0 2 2 2 2 2 1 2 1 3 3 2 3 2 3 0 2 0 1 0 0 3 2 1 1 0 1 2 1 1 0 1 3 1 3 3 2 2 3 0 2 1 3 2 1 0 1 2 3 2 2 3 3 1 0 2 0 3 2 3 0 1 2 0 3 3 0 2 1 1 3 3 2 2 0 2 2 1 1 2 ...
output:
50863 68187 40176 82517
result:
ok single line: '50863 68187 40176 82517 '
Test #11:
score: 0
Accepted
time: 34ms
memory: 34612kb
input:
79392 0 2 2 2 0 3 2 3 1 1 1 0 0 3 1 3 3 0 2 2 0 0 0 2 1 0 2 2 2 1 2 3 2 0 3 3 3 2 0 1 0 1 1 1 0 1 0 1 0 2 3 3 0 1 2 3 0 1 0 1 0 1 2 2 1 3 0 0 1 3 1 2 2 1 0 0 2 1 0 0 2 2 3 1 3 0 3 2 0 0 0 0 3 3 0 0 2 2 0 2 0 2 3 1 0 2 2 1 2 2 0 3 3 3 2 1 3 1 1 1 1 2 0 0 1 1 1 0 1 1 1 3 3 0 2 3 1 1 0 1 2 3 1 3 3 0 0 ...
output:
68113 34911 26794 79392
result:
ok single line: '68113 34911 26794 79392 '
Test #12:
score: 0
Accepted
time: 96ms
memory: 39320kb
input:
100000 2 0 0 1 0 2 3 3 0 2 1 2 0 2 0 3 0 0 2 0 1 1 0 1 1 1 1 0 2 2 0 1 0 1 0 0 0 3 1 0 3 0 1 1 1 3 1 0 1 3 1 1 1 0 1 3 0 1 1 0 1 3 0 0 0 0 0 0 0 1 0 0 1 3 1 3 0 1 0 0 2 1 1 2 2 0 3 3 2 1 1 0 0 1 1 2 0 1 2 0 3 3 1 1 1 0 3 3 0 1 3 0 1 0 2 1 3 3 2 3 2 0 2 3 0 2 2 2 0 1 0 0 1 0 2 1 1 1 2 1 2 1 1 0 3 1 1...
output:
448 100000 52 33
result:
ok single line: '448 100000 52 33 '
Test #13:
score: 0
Accepted
time: 62ms
memory: 41020kb
input:
100000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 3 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 3 0 0 0 0 0 3 0 0 0 0 0...
output:
100000 0 0 11
result:
ok single line: '100000 0 0 11 '
Test #14:
score: 0
Accepted
time: 57ms
memory: 41528kb
input:
100000 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
0 0 100000 0
result:
ok single line: '0 0 100000 0 '
Test #15:
score: 0
Accepted
time: 63ms
memory: 41216kb
input:
100000 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
0 0 33423 100000
result:
ok single line: '0 0 33423 100000 '
Test #16:
score: 0
Accepted
time: 0ms
memory: 24252kb
input:
2 2 0
output:
1 0 1 0
result:
ok single line: '1 0 1 0 '
Test #17:
score: 0
Accepted
time: 72ms
memory: 46480kb
input:
100000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
59937 100000 30184 50197
result:
ok single line: '59937 100000 30184 50197 '
Test #18:
score: 0
Accepted
time: 91ms
memory: 47824kb
input:
100000 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
1 3 100000 1
result:
ok single line: '1 3 100000 1 '
Test #19:
score: 0
Accepted
time: 47ms
memory: 37868kb
input:
100000 2 2 0 3 1 3 1 1 1 2 2 3 1 0 1 3 1 3 3 2 2 2 0 3 2 0 2 0 1 2 0 0 1 0 3 0 1 2 0 3 0 2 2 3 1 3 0 0 0 0 0 2 1 0 2 3 2 2 3 1 0 2 0 0 2 1 3 2 3 2 2 2 3 0 2 2 2 1 1 2 1 3 1 1 0 2 3 0 1 2 2 3 2 0 2 2 1 2 0 2 3 0 3 2 1 1 0 2 3 3 1 0 0 2 3 0 0 3 2 0 1 0 2 1 2 2 3 1 2 0 1 0 1 0 3 3 2 2 2 1 3 2 0 2 1 0 2...
output:
99993 99996 99997 99997
result:
ok single line: '99993 99996 99997 99997 '
Test #20:
score: 0
Accepted
time: 97ms
memory: 39672kb
input:
100000 2 1 0 1 1 1 3 2 1 0 2 1 1 1 1 1 3 0 3 1 1 1 1 1 1 2 3 1 0 2 1 1 2 3 1 0 1 3 1 1 3 1 3 3 2 1 2 1 1 1 1 1 1 1 1 1 1 1 2 3 1 0 3 1 1 3 1 1 1 2 3 2 3 1 1 3 0 3 0 1 2 2 3 1 3 1 0 2 3 1 1 1 3 1 1 0 1 2 1 0 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 0 3 3 2 0 3 1 1 0 1 2 3 3 1 1 1 1 1 3 1 1 1 3 0 2 1...
output:
69 100000 42 181
result:
ok single line: '69 100000 42 181 '
Test #21:
score: 0
Accepted
time: 65ms
memory: 37824kb
input:
100000 2 2 0 2 1 2 2 0 0 0 3 0 2 1 0 2 0 0 3 0 0 1 1 0 2 1 3 0 0 1 1 2 1 2 0 2 2 2 1 2 2 2 2 0 1 0 0 2 3 1 2 2 0 1 3 2 1 1 0 0 0 1 1 1 2 1 2 0 0 2 3 2 1 2 1 1 2 2 1 3 2 0 2 1 0 1 2 0 1 2 3 2 2 0 3 2 3 1 2 0 1 2 2 0 2 1 1 1 2 0 2 1 2 2 0 3 1 3 2 0 1 1 2 0 2 0 2 2 2 0 0 1 1 1 2 3 2 1 1 3 1 1 2 1 1 3 3...
output:
99998 99997 99265 50
result:
ok single line: '99998 99997 99265 50 '
Test #22:
score: 0
Accepted
time: 45ms
memory: 37460kb
input:
100000 1 1 3 0 0 3 1 0 1 0 1 2 2 3 0 3 3 2 1 1 0 2 0 1 2 0 3 0 2 3 1 1 3 1 3 2 1 0 0 1 3 0 0 3 3 3 3 3 1 0 1 1 1 0 1 2 1 1 0 1 1 0 1 3 3 0 2 1 3 1 1 2 2 2 2 1 0 1 1 1 3 2 3 1 1 3 0 3 0 3 2 3 2 3 0 0 1 3 3 2 0 1 1 1 3 2 0 1 3 0 1 2 2 2 1 3 1 1 1 1 1 0 2 3 3 2 3 3 3 2 2 3 1 2 0 1 1 3 1 1 3 3 2 2 1 2 1...
output:
99902 99960 99996 99996
result:
ok single line: '99902 99960 99996 99996 '
Test #23:
score: 0
Accepted
time: 46ms
memory: 38648kb
input:
100000 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2...
output:
99997 99997 99997 99997
result:
ok single line: '99997 99997 99997 99997 '
Test #24:
score: 0
Accepted
time: 62ms
memory: 45272kb
input:
100000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3...
output:
49999 74998 74998 49999
result:
ok single line: '49999 74998 74998 49999 '
Test #25:
score: 0
Accepted
time: 52ms
memory: 38848kb
input:
100000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3...
output:
99038 98842 99667 74993
result:
ok single line: '99038 98842 99667 74993 '
Test #26:
score: 0
Accepted
time: 76ms
memory: 41988kb
input:
100000 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0 2 3 0 1 2 0...
output:
99997 1 100000 1
result:
ok single line: '99997 1 100000 1 '
Test #27:
score: 0
Accepted
time: 2ms
memory: 24092kb
input:
3 3 1 3
output:
0 1 0 3
result:
ok single line: '0 1 0 3 '
Test #28:
score: 0
Accepted
time: 75ms
memory: 41096kb
input:
100000 2 2 0 0 3 3 0 2 1 2 1 0 2 2 0 0 3 3 0 2 1 2 1 0 2 2 0 0 3 3 0 2 1 2 1 0 2 2 0 0 3 3 0 2 1 2 1 0 2 2 0 0 3 3 0 2 1 2 1 0 2 2 0 0 3 3 0 2 1 2 1 0 2 2 0 0 3 3 0 2 1 2 1 0 2 2 0 0 3 3 0 2 1 2 1 0 2 2 0 0 3 3 0 2 1 2 1 0 2 2 0 0 3 3 0 2 1 2 1 0 2 2 0 0 3 3 0 2 1 2 1 0 2 2 0 0 3 3 0 2 1 2 1 0 2 2 0...
output:
99999 4 99999 5
result:
ok single line: '99999 4 99999 5 '
Test #29:
score: 0
Accepted
time: 45ms
memory: 37284kb
input:
100000 2 2 2 0 0 2 2 3 2 0 1 1 1 2 2 3 2 2 2 2 2 0 1 2 1 1 3 3 3 0 2 1 2 1 0 3 0 3 3 2 3 0 3 3 0 3 3 3 1 2 1 1 2 1 2 2 0 2 1 2 3 1 2 2 2 1 1 3 3 3 2 2 0 1 1 0 0 3 2 2 1 1 1 3 2 2 3 1 2 1 0 2 0 2 2 3 3 2 1 0 2 3 0 0 1 0 0 3 0 1 2 2 1 0 0 0 3 1 1 1 1 0 0 2 2 2 1 1 2 3 2 3 0 0 3 2 0 3 0 1 0 3 0 0 0 1 0...
output:
31701 90659 88119 100000
result:
ok single line: '31701 90659 88119 100000 '
Test #30:
score: 0
Accepted
time: 51ms
memory: 36952kb
input:
100000 0 1 3 2 2 0 1 0 2 0 1 2 1 1 1 3 0 2 1 1 3 2 3 2 0 3 2 2 2 3 3 1 0 0 1 3 0 2 3 1 0 0 1 1 3 0 2 0 2 2 2 0 2 1 1 0 2 3 0 3 0 2 0 2 3 0 2 1 2 3 1 0 2 1 0 1 2 2 3 1 3 1 0 1 1 2 0 1 2 2 0 1 1 3 3 0 0 1 3 1 1 0 0 3 2 0 1 0 1 1 3 2 1 3 2 3 1 3 2 2 2 3 1 0 3 0 1 0 3 2 0 3 2 1 3 3 2 3 1 0 1 1 3 3 0 1 3...
output:
62661 100000 86884 68086
result:
ok single line: '62661 100000 86884 68086 '
Test #31:
score: 0
Accepted
time: 77ms
memory: 38148kb
input:
100000 2 0 3 2 2 1 1 0 0 3 1 2 1 3 1 3 3 0 0 3 2 2 0 0 3 0 1 3 3 2 1 3 1 1 0 1 1 2 2 1 0 3 2 2 2 0 1 3 2 0 1 2 2 3 2 0 1 3 2 3 0 2 0 2 3 3 2 2 2 1 3 0 1 0 3 0 1 2 2 2 1 1 0 0 0 3 1 2 2 0 3 0 2 1 2 2 1 0 0 0 2 0 1 3 1 0 0 2 0 0 3 2 2 2 1 3 3 3 2 2 0 0 3 1 1 2 0 3 3 1 2 1 1 0 0 3 1 2 0 1 2 0 0 0 3 2 3...
output:
77511 28943 63391 100000
result:
ok single line: '77511 28943 63391 100000 '
Test #32:
score: 0
Accepted
time: 43ms
memory: 37184kb
input:
100000 1 2 3 1 0 2 0 0 0 3 3 0 2 1 2 0 0 3 2 2 3 0 1 3 3 3 1 2 0 2 3 0 2 1 1 2 0 0 3 3 2 1 1 3 2 0 0 3 0 0 0 3 3 1 1 1 1 0 0 3 1 2 1 1 0 2 3 3 0 2 0 0 2 3 0 0 0 3 2 2 2 1 1 3 2 0 3 3 3 0 0 1 0 1 1 0 2 3 2 0 1 2 2 0 1 3 1 2 3 1 3 1 1 2 0 1 3 1 0 1 2 3 2 3 0 1 3 3 1 1 2 2 3 0 2 0 0 1 3 3 2 3 0 3 2 2 3...
output:
81571 73712 100000 99871
result:
ok single line: '81571 73712 100000 99871 '
Test #33:
score: 0
Accepted
time: 47ms
memory: 37944kb
input:
100000 3 0 1 0 1 0 3 1 2 0 2 3 2 3 1 0 1 0 3 0 1 0 0 1 0 0 1 1 0 2 1 2 3 0 1 2 2 1 0 2 1 1 0 1 3 1 3 0 0 1 2 1 2 3 3 3 0 3 0 0 3 0 1 0 3 1 1 1 1 1 1 3 3 3 3 0 0 0 1 1 0 1 1 3 3 2 0 1 1 1 3 0 0 3 3 3 2 3 3 2 2 1 0 3 1 3 3 1 2 2 3 3 0 3 1 2 0 1 3 3 3 1 1 2 3 2 0 1 2 2 0 2 0 1 1 2 3 1 3 2 2 0 2 0 3 3 2...
output:
27558 100000 48059 95964
result:
ok single line: '27558 100000 48059 95964 '
Test #34:
score: 0
Accepted
time: 5ms
memory: 24128kb
input:
4 2 1 3 0
output:
1 1 1 1
result:
ok single line: '1 1 1 1 '
Test #35:
score: 0
Accepted
time: 0ms
memory: 24568kb
input:
10 1 0 1 2 3 0 2 0 1 3
output:
9 5 5 1
result:
ok single line: '9 5 5 1 '
Test #36:
score: 0
Accepted
time: 0ms
memory: 24444kb
input:
2970 2 2 3 2 3 2 3 1 2 2 1 1 1 3 0 3 1 1 1 3 3 2 1 2 1 3 3 0 1 0 2 0 1 3 3 3 0 3 3 3 1 3 3 1 2 3 2 0 2 2 2 0 2 3 3 2 0 1 1 1 0 3 2 1 0 2 0 0 1 2 0 2 0 2 1 3 3 2 1 1 2 1 3 2 0 0 3 2 2 2 0 0 1 0 3 1 2 1 1 2 0 1 2 3 3 0 2 0 2 0 3 2 2 1 1 1 1 0 2 0 1 0 2 2 1 0 3 0 3 1 2 3 0 0 2 3 2 0 3 3 3 1 2 3 0 2 1 2...
output:
2590 2970 2754 2815
result:
ok single line: '2590 2970 2754 2815 '
Test #37:
score: 0
Accepted
time: 3ms
memory: 24800kb
input:
3362 2 1 3 3 1 0 1 2 1 3 2 3 1 1 3 2 3 1 0 3 0 0 0 3 0 0 0 2 1 1 3 0 0 1 1 3 3 0 2 0 3 3 2 3 3 1 2 3 0 2 0 2 1 3 2 0 3 0 1 1 2 1 3 0 1 3 3 2 2 3 3 0 2 2 2 0 3 1 3 3 0 3 2 3 1 3 3 1 0 0 3 3 3 2 0 3 1 3 2 3 2 1 3 3 3 1 1 0 1 2 2 2 0 1 0 0 1 1 1 1 3 3 2 0 1 2 3 0 3 2 3 1 3 3 1 1 0 0 3 3 0 3 1 2 3 0 3 0...
output:
1302 2637 1953 3362
result:
ok single line: '1302 2637 1953 3362 '
Test #38:
score: 0
Accepted
time: 6ms
memory: 24992kb
input:
4523 1 1 2 2 3 3 3 1 1 2 1 0 0 1 3 0 2 1 1 1 1 1 0 0 1 0 1 1 0 0 2 2 3 2 1 2 1 0 3 2 2 0 2 0 1 1 1 0 2 2 3 3 3 2 2 3 1 3 3 2 0 2 1 2 1 3 1 1 2 3 0 2 3 1 2 0 1 0 0 2 2 2 1 1 2 1 3 2 0 0 0 1 0 1 2 2 0 2 1 1 0 3 2 0 0 0 0 1 2 3 3 1 2 0 0 3 3 0 0 1 0 2 1 1 2 0 1 1 2 3 2 3 3 0 3 0 2 3 0 2 1 2 2 3 1 0 3 0...
output:
4523 4511 3922 4475
result:
ok single line: '4523 4511 3922 4475 '
Test #39:
score: 0
Accepted
time: 0ms
memory: 24424kb
input:
2403 3 1 0 0 2 3 3 3 2 2 1 0 2 3 3 1 3 0 3 2 2 2 2 2 3 1 2 3 0 1 1 2 1 3 1 2 1 0 0 3 2 3 0 3 0 1 1 3 3 0 3 1 0 3 1 0 3 1 0 3 0 1 0 0 1 1 3 2 3 1 3 3 1 3 1 0 0 0 2 1 0 1 1 0 3 0 0 3 0 2 1 2 3 2 3 0 3 0 0 2 1 2 1 3 2 2 1 2 3 1 3 3 3 3 1 1 1 1 2 0 3 3 1 2 0 1 2 2 0 3 1 3 2 0 3 3 0 2 3 0 0 1 0 2 1 3 2 0...
output:
1437 2403 2320 1954
result:
ok single line: '1437 2403 2320 1954 '