QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#87722 | #4929. Longest Unfriendly Subsequence | snpmrnhlol | 0 | 133ms | 21296kb | C++14 | 3.9kb | 2023-03-14 05:24:57 | 2023-03-14 05:24:59 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int v[200000];
int pre[200000][6];
map <int,int> f;
pair <int,int> dp[200001][2];
///first - chosen bitch, second - maxxxxxx
void solve(){
f.clear();
int n,i,j,l,cnt = 1,ans = 0;
cin>>n;
for(i = 0;i < n;i++){
cin>>v[i];
f[v[i]] = 1;
for(j = 0;j < 6;j++)pre[i][j] = -1;
dp[i][0] = dp[i][1] = {0,-1};
}
for(auto &i:f){
i.second = cnt++;
}
for(i = 0;i < n;i++){
v[i] = f[v[i]];
bool ok = 0;
if(i)for(j = 0;j < 6;j++){
if(pre[i - 1][j] == v[i]){
///same
for(l = j + 1;l < 6;l++)pre[i][l] = pre[i - 1][l];
for(l = j;l > 0;l--){
pre[i][l] = pre[i - 1][l - 1];
}
pre[i][0] = v[i];
ok = 1;
}
}
if(!ok){
if(i)for(j = 6;j > 0;j--){
pre[i][j] = pre[i - 1][j - 1];
}
pre[i][0] = v[i];
}
}
for(i = 0;i < n;i++){
int cur = 0,cand = -1,cur2 = 0,cand2 = -1;
if(i)for(j = 0;j < 6;j++){
if(pre[i - 1][j] == -1 || pre[i - 1][j] == v[i])continue;
//if(v[i] == 3)cout<<pre[i - 1][j]<<' '<<dp[pre[i - 1][j]][0].first<<' '<<dp[pre[i - 1][j]][0].second<<' '<<dp[pre[i - 1][j]][1].first<<' '<<dp[pre[i - 1][j]][1].second<<'\n';
//if(pre[i - 1][j] == 3)cout<<pre[i - 1][j]<<' '<<dp[pre[i - 1][j]][0].first<<' '<<dp[pre[i - 1][j]][0].second<<' '<<dp[pre[i - 1][j]][1].first<<' '<<dp[pre[i - 1][j]][1].second<<'\n';
if(dp[pre[i - 1][j]][0].first != v[i] && dp[pre[i - 1][j]][0].second >= cur){
cur = dp[pre[i - 1][j]][0].second;
cand = pre[i - 1][j];
}
if(dp[pre[i - 1][j]][1].first != v[i] && dp[pre[i - 1][j]][1].second >= cur){
cur = dp[pre[i - 1][j]][1].second;
cand = pre[i - 1][j];
}
}
if(i)for(j = 0;j < 6;j++){
if(pre[i - 1][j] == -1 || pre[i - 1][j] == v[i] || pre[i - 1][j] == cand)continue;
//cout<<pre[i - 1][j]<<' ';
if(dp[pre[i - 1][j]][0].first != v[i] && dp[pre[i - 1][j]][0].second >= cur2){
cur2 = dp[pre[i - 1][j]][0].second;
cand2 = pre[i - 1][j];
}
if(dp[pre[i - 1][j]][1].first != v[i] && dp[pre[i - 1][j]][1].second >= cur2){
cur2 = dp[pre[i - 1][j]][1].second;
cand2 = pre[i - 1][j];
}
}
cur2++;
cur++;
ans = max(ans,cur);
ans = max(ans,cur2);
//if(v[i] == 3)cout<<cur<<' '<<cand<<' '<<cur2<<' '<<cand2<<'\n';
///propagation
if(dp[v[i]][0].first == cand){
if(dp[v[i]][0].second <= cur){
dp[v[i]][0].second = cur;
}
}else if(dp[v[i]][1].first == cand){
if(dp[v[i]][1].second <= cur){
dp[v[i]][1].second = cur;
}
}else if(dp[v[i]][0].second <= cur){
dp[v[i]][1] = dp[v[i]][0];
dp[v[i]][0] = {cand,cur};
}else if(dp[v[i]][1].second <= cur){
dp[v[i]][1] = {cand,cur};
}
if(dp[v[i]][0].first == cand2){
if(dp[v[i]][0].second <= cur2){
dp[v[i]][0].second = cur2;
}
}else if(dp[v[i]][1].first == cand2){
if(dp[v[i]][1].second <= cur2){
dp[v[i]][1].second = cur2;
}
}else if(dp[v[i]][0].second <= cur2){
dp[v[i]][1] = dp[v[i]][0];
dp[v[i]][0] = {cand2,cur2};
}else if(dp[v[i]][1].second <= cur2){
dp[v[i]][1] = {cand2,cur2};
}
}
cout<<ans<<'\n';
}
int main(){
int t;
cin>>t;
while(t--)solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 3
Accepted
time: 53ms
memory: 11968kb
input:
1 200000 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 2...
output:
1
result:
ok single line: '1'
Test #2:
score: -3
Wrong Answer
time: 133ms
memory: 21296kb
input:
1 200000 1521 1638 11981 18811 20091 22081 30494 31501 42139 42282 48197 55520 57632 69584 81745 85026 90303 91482 92176 98507 108061 108743 111257 121226 127217 127449 137116 163474 169192 175764 181243 185402 191244 198775 202845 212156 217723 220058 223478 224205 227614 228398 230425 232567 24480...
output:
198857
result:
wrong answer 1st lines differ - expected: '198858', found: '198857'
Subtask #2:
score: 0
Wrong Answer
Test #15:
score: 6
Accepted
time: 2ms
memory: 3268kb
input:
3 5 1 2 1 2 1 7 1 2 3 2 1 2 3 8 1 10 10 1 1 100 100 1
output:
2 6 4
result:
ok 3 lines
Test #16:
score: -6
Wrong Answer
time: 129ms
memory: 3384kb
input:
28653 6 372076545 832760265 372076545 644300403 644300403 644300403 8 540046638 375129642 863244619 863244619 375129642 540046638 540046638 540046638 6 142783193 508154499 871683432 71368434 871683432 871683432 8 760894385 984189193 760894385 323542350 984189193 760894385 323542350 323542350 6 84093...
output:
3 4 4 6 4 4 3 4 5 4 5 4 2 4 5 5 4 3 5 5 4 4 4 5 6 4 2 3 4 3 2 3 4 3 8 4 5 5 4 6 4 5 5 5 4 6 6 4 3 3 7 5 3 7 3 4 6 6 5 4 3 3 6 3 6 4 3 4 4 6 3 4 5 4 5 1 3 6 4 4 4 4 2 3 4 2 5 3 4 2 2 3 4 3 6 3 5 3 4 5 3 3 4 4 5 3 5 4 4 6 5 6 6 4 5 4 5 5 3 4 3 4 4 2 4 4 6 5 4 3 3 2 3 5 4 5 3 3 4 7 4 5 5 2 5 2 4 4 5 4 ...
result:
wrong answer 70th lines differ - expected: '7', found: '6'
Subtask #3:
score: 0
Wrong Answer
Test #19:
score: 8
Accepted
time: 2ms
memory: 3348kb
input:
1 500 537076440 691668159 871942500 537076440 537076440 691668159 871942500 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 871942500 537076440 691668159 871942500 537076440 537076440 6916...
output:
361
result:
ok single line: '361'
Test #20:
score: 0
Accepted
time: 2ms
memory: 3408kb
input:
1 500 584142119 101442702 335815880 584142119 101442702 335815880 584142119 101442702 335815880 584142119 101442702 335815880 584142119 101442702 101442702 335815880 335815880 584142119 584142119 101442702 101442702 335815880 584142119 101442702 335815880 584142119 101442702 335815880 584142119 1014...
output:
394
result:
ok single line: '394'
Test #21:
score: 0
Accepted
time: 2ms
memory: 3492kb
input:
1 500 296341737 806184542 989331127 989331127 296341737 806184542 455929030 296341737 806184542 806184542 806184542 989331127 296341737 806184542 989331127 296341737 806184542 989331127 296341737 806184542 989331127 296341737 806184542 806184542 989331127 296341737 296341737 296341737 806184542 9893...
output:
339
result:
ok single line: '339'
Test #22:
score: 0
Accepted
time: 1ms
memory: 3492kb
input:
1 500 361183277 863317163 788070566 361183277 361183277 863317163 788070566 361183277 632739493 788070566 788070566 361183277 863317163 788070566 361183277 863317163 788070566 361183277 863317163 788070566 361183277 863317163 788070566 361183277 863317163 788070566 361183277 863317163 788070566 3611...
output:
353
result:
ok single line: '353'
Test #23:
score: 0
Accepted
time: 1ms
memory: 3392kb
input:
1 500 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 5755...
output:
423
result:
ok single line: '423'
Test #24:
score: 0
Accepted
time: 2ms
memory: 3544kb
input:
3 68 975239020 470667175 323925950 975239020 470667175 323925950 975239020 470667175 323925950 975239020 470667175 323925950 975239020 470667175 323925950 975239020 470667175 323925950 323925950 323925950 975239020 470667175 323925950 975239020 470667175 323925950 323925950 975239020 470667175 32392...
output:
48 386 3
result:
ok 3 lines
Test #25:
score: -8
Wrong Answer
time: 2ms
memory: 3372kb
input:
3 118 150373656 793064947 635264518 635264518 709296672 793064947 635264518 709296672 709296672 709296672 793064947 635264518 709296672 793064947 635264518 709296672 793064947 793064947 635264518 709296672 793064947 793064947 635264518 709296672 793064947 635264518 709296672 793064947 635264518 7092...
output:
97 227 33
result:
wrong answer 2nd lines differ - expected: '230', found: '227'
Subtask #4:
score: 0
Wrong Answer
Test #79:
score: 10
Accepted
time: 39ms
memory: 11968kb
input:
1 200000 1 3 3 2 2 3 3 1 2 3 1 1 3 3 3 2 1 1 2 3 2 1 3 3 3 1 2 2 1 3 1 2 1 2 3 2 3 3 2 2 3 2 3 2 3 1 1 1 1 1 3 1 3 2 3 3 3 3 1 3 2 1 3 2 3 2 3 1 1 1 1 3 3 2 3 2 1 2 2 3 2 3 2 2 2 2 2 2 3 2 1 2 2 1 1 3 2 1 2 1 1 3 3 3 2 1 2 2 2 1 3 3 2 3 2 1 3 3 2 2 1 3 1 3 2 1 2 3 2 1 2 3 2 2 3 2 1 2 1 1 1 1 1 1 1 3...
output:
66691
result:
ok single line: '66691'
Test #80:
score: 0
Accepted
time: 31ms
memory: 11848kb
input:
1 200000 2 2 3 3 3 2 1 2 1 1 1 3 3 2 3 3 1 3 2 3 3 3 2 1 2 2 2 2 1 1 2 2 1 3 1 3 1 3 3 1 2 1 1 2 1 1 2 1 1 1 1 2 2 1 3 2 3 3 2 3 2 3 1 1 1 1 2 3 1 2 1 1 2 3 2 3 3 2 1 2 1 1 3 3 3 1 2 3 1 3 1 3 1 1 2 1 3 2 1 1 3 2 1 1 3 2 3 2 3 2 1 3 2 2 2 1 2 2 1 3 3 1 3 1 2 3 1 1 2 2 2 1 3 1 1 3 3 2 3 2 1 3 1 1 1 3...
output:
66403
result:
ok single line: '66403'
Test #81:
score: 0
Accepted
time: 29ms
memory: 11944kb
input:
1 200000 1 2 3 3 1 2 3 3 1 2 3 1 1 2 3 1 2 3 1 2 2 3 1 2 2 3 3 3 1 2 3 3 1 2 3 3 1 1 2 2 3 3 1 2 3 3 1 1 2 3 1 2 2 3 3 1 2 3 1 1 1 1 2 3 3 1 2 2 3 1 1 1 2 2 3 3 1 1 1 2 2 3 1 1 2 3 3 1 1 2 3 1 2 3 1 2 3 3 1 1 2 3 1 1 1 1 2 3 1 2 3 3 1 2 2 2 2 2 3 1 1 2 3 1 2 2 3 1 2 3 3 1 2 2 3 1 2 3 1 1 1 2 2 3 1 2...
output:
113082
result:
ok single line: '113082'
Test #82:
score: 0
Accepted
time: 33ms
memory: 12124kb
input:
1 200000 2 3 3 1 2 2 2 3 1 1 2 3 1 2 2 3 3 1 2 3 3 3 3 3 3 1 2 3 1 2 3 3 1 2 2 3 3 1 2 3 3 3 1 2 2 3 3 3 1 2 2 3 3 3 3 3 1 1 2 3 1 2 3 3 1 1 2 2 3 1 1 1 1 2 3 1 2 2 3 3 3 1 2 3 1 1 2 2 3 1 1 1 1 2 2 3 3 3 3 1 1 2 3 1 2 3 1 1 1 2 3 3 1 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 2 3 3 1 2 2 3 3 1 1 1 2 2 3 1 1 1 2...
output:
98984
result:
ok single line: '98984'
Test #83:
score: 0
Accepted
time: 35ms
memory: 12120kb
input:
1 200000 3 2 2 2 1 1 2 2 2 1 3 2 3 3 3 1 3 1 3 3 2 1 1 2 1 2 3 2 2 3 1 3 3 2 3 2 3 3 3 2 3 2 3 3 3 3 1 2 3 2 2 1 1 2 3 1 3 1 1 2 1 2 1 1 1 3 3 1 3 2 2 2 1 1 2 3 3 3 1 3 3 3 1 3 2 2 1 3 3 1 3 3 1 3 3 1 3 1 1 1 3 2 3 1 3 1 3 3 3 2 2 2 3 3 2 1 2 1 3 3 2 1 1 3 1 2 2 1 3 1 2 2 3 2 1 2 2 1 3 2 3 3 3 1 1 2...
output:
66809
result:
ok single line: '66809'
Test #84:
score: 0
Accepted
time: 33ms
memory: 12004kb
input:
1 200000 3 1 3 1 3 1 2 1 2 2 3 1 3 2 3 1 1 3 1 3 2 3 3 3 3 1 1 1 2 2 1 1 3 1 2 2 2 1 2 1 1 2 3 2 2 1 3 2 2 2 3 1 1 2 3 1 3 2 1 1 3 1 1 3 1 2 3 1 2 1 2 1 1 1 3 1 1 1 1 3 2 1 2 3 3 2 2 3 1 1 2 1 1 2 1 3 1 3 3 1 1 1 1 1 3 2 3 2 3 1 3 2 1 3 1 3 2 1 1 1 3 2 1 1 3 1 3 3 3 2 2 3 1 3 1 1 3 3 3 2 1 3 3 1 1 1...
output:
66929
result:
ok single line: '66929'
Test #85:
score: 0
Accepted
time: 37ms
memory: 11952kb
input:
1 200000 1 2 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 2 3 1 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 3 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 1 2 2 3 1 2 3 1 2 3 1 2 3 1 1...
output:
165153
result:
ok single line: '165153'
Test #86:
score: 0
Accepted
time: 32ms
memory: 12128kb
input:
1 200000 3 1 2 3 1 2 3 1 2 3 3 1 2 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2...
output:
161302
result:
ok single line: '161302'
Test #87:
score: 0
Accepted
time: 36ms
memory: 9976kb
input:
3 14732 1 3 2 1 3 3 1 1 3 2 1 2 1 1 1 3 1 3 1 1 3 2 1 1 3 2 3 3 2 1 3 3 3 3 1 1 1 2 3 2 1 3 3 3 1 2 1 1 3 1 1 2 2 1 3 3 3 2 3 2 1 2 2 3 1 3 3 2 2 3 1 2 1 1 3 2 2 2 1 2 3 3 1 3 3 2 1 1 1 1 2 1 3 1 2 3 3 2 2 1 3 3 3 2 2 2 1 1 1 1 1 2 1 2 1 3 2 2 1 3 2 3 2 3 3 1 3 1 1 2 1 1 2 1 1 3 2 1 2 3 2 1 3 1 3 3 ...
output:
4957 130118 23430
result:
ok 3 lines
Test #88:
score: 0
Accepted
time: 38ms
memory: 8124kb
input:
3 46973 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 ...
output:
35431 19615 37542
result:
ok 3 lines
Test #89:
score: 0
Accepted
time: 37ms
memory: 8568kb
input:
3 19336 2 3 1 2 2 3 1 1 2 3 3 1 2 2 2 3 3 3 1 2 3 1 2 2 3 3 3 1 1 1 1 1 2 2 3 3 3 3 1 1 1 2 2 2 2 3 1 1 1 1 2 2 2 3 3 3 3 1 1 2 2 2 3 1 2 3 1 2 2 3 3 3 1 2 3 1 2 3 1 2 3 3 1 1 2 3 3 1 2 2 2 2 2 2 3 3 1 2 3 1 2 2 3 3 1 1 1 1 2 3 1 1 1 1 1 2 2 2 2 2 2 3 3 3 1 2 3 1 2 3 3 1 2 3 3 3 3 3 3 1 2 2 2 2 2 2 ...
output:
8087 53502 40182
result:
ok 3 lines
Test #90:
score: 0
Accepted
time: 33ms
memory: 8056kb
input:
3 111453 2 3 2 2 3 2 2 2 1 1 1 2 2 2 3 2 2 1 3 1 3 3 1 3 2 2 1 3 1 2 2 2 3 1 3 2 1 2 1 1 3 3 1 1 3 1 1 2 1 2 1 1 1 3 3 3 1 1 1 3 2 2 1 3 2 1 1 3 1 2 3 3 1 2 2 2 1 3 2 2 2 2 2 2 2 3 2 1 3 1 2 1 3 1 1 1 2 3 3 1 3 2 1 3 2 2 2 3 1 3 3 3 2 1 3 2 1 3 2 1 3 3 3 1 1 2 1 2 1 3 2 2 2 3 3 1 2 1 2 2 3 3 2 2 2 2...
output:
37432 9380 2
result:
ok 3 lines
Test #91:
score: 0
Accepted
time: 27ms
memory: 11960kb
input:
1 200000 1 2 3 1 2 3 1 2 3 3 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2...
output:
161232
result:
ok single line: '161232'
Test #92:
score: 0
Accepted
time: 29ms
memory: 11904kb
input:
1 200000 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2...
output:
177380
result:
ok single line: '177380'
Test #93:
score: 0
Accepted
time: 32ms
memory: 12008kb
input:
1 200000 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 3 2 2 1 3 2 1 3 2 1 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 3 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1...
output:
152945
result:
ok single line: '152945'
Test #94:
score: 0
Accepted
time: 36ms
memory: 11944kb
input:
1 200000 3 2 1 3 1 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 3 3 3 3 2 2 1 3 2 1 3 3 2 1 3 2 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 1 3 2 2 1 3 2 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 2 1 3 2 1 3 2...
output:
139711
result:
ok single line: '139711'
Test #95:
score: 0
Accepted
time: 33ms
memory: 11964kb
input:
1 200000 2 3 3 1 2 3 1 2 2 1 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 2 3 1 2 3 1 2 3 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 1 2 3...
output:
159913
result:
ok single line: '159913'
Test #96:
score: 0
Accepted
time: 28ms
memory: 12008kb
input:
1 200000 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 1 2 2 3 1 2 3 1 2 3 1 2 3 1 1 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 3 1 2 2 3 1 2 3 1 2 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 2 3 1...
output:
164070
result:
ok single line: '164070'
Test #97:
score: 0
Accepted
time: 33ms
memory: 11856kb
input:
1 200000 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 2 1 3 3 2 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 2 2 1 3 2 1 1 3 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 3 2 1 1 3 2 1 3 2 1 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 1 3...
output:
141972
result:
ok single line: '141972'
Test #98:
score: 0
Accepted
time: 27ms
memory: 12100kb
input:
1 200000 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 3 2 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2...
output:
180569
result:
ok single line: '180569'
Test #99:
score: 0
Accepted
time: 25ms
memory: 8636kb
input:
3 67258 1 3 2 1 3 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 2 1 3 2 1 ...
output:
55713 10294 102575
result:
ok 3 lines
Test #100:
score: 0
Accepted
time: 36ms
memory: 8292kb
input:
3 110746 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 1 2 3 3 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 1 2 3 3 1 2 3 1 2 3 1 2 3 1 1 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2...
output:
78787 56073 17413
result:
ok 3 lines
Test #101:
score: 0
Accepted
time: 30ms
memory: 7292kb
input:
3 88522 1 2 2 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 3 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 1 2 3 1 2 2 3 1 2 3 3 1 2 3 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 1 2 3 3 1 1 1 2 3 1 2 3 1 ...
output:
72954 15040 67627
result:
ok 3 lines
Test #102:
score: 0
Accepted
time: 27ms
memory: 7256kb
input:
3 38399 2 1 1 3 2 1 3 2 1 3 3 3 2 1 3 2 1 3 3 2 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 1 1 3 2 1 3 2 1 3 3 3 2 2 2 1 3 2 1 3 3 2 1 1 1 3 2 1 3 2 1 3 2 2 1 3 2 2 1 3 2 1 3 2 1 3 2 ...
output:
27852 58832 74901
result:
ok 3 lines
Test #103:
score: 0
Accepted
time: 29ms
memory: 6348kb
input:
10 23759 3 2 1 2 1 2 1 2 2 2 2 1 1 1 3 1 3 1 3 3 2 1 1 3 3 2 3 2 2 1 3 2 3 3 2 1 3 1 2 3 3 3 2 1 1 3 3 1 2 3 3 2 3 3 1 2 3 3 2 2 1 2 3 2 3 1 1 3 3 3 2 3 3 3 1 1 3 2 3 2 2 3 2 1 1 1 1 2 1 3 3 1 3 2 3 3 1 3 3 1 1 2 3 1 3 2 3 3 2 2 3 1 3 3 2 3 1 3 2 3 3 3 1 2 3 2 3 1 3 1 3 2 2 3 3 2 1 2 2 2 3 1 2 2 2 2...
output:
8049 15976 3898 1817 4647 15431 43707 2827 2372 17780
result:
ok 10 lines
Test #104:
score: 0
Accepted
time: 34ms
memory: 5164kb
input:
15 3978 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 3 1 2 2 2 3 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 1 1 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 2 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 1 1 2 3 3 3 1 2 3 1 ...
output:
2648 2 12485 3542 2427 2686 13541 17826 1973 10284 16751 13183 2992 4312 643
result:
ok 15 lines
Test #105:
score: 0
Accepted
time: 27ms
memory: 4720kb
input:
20 2162 3 2 3 1 2 2 3 3 1 1 1 2 2 2 3 3 2 2 1 3 2 1 3 3 3 3 2 1 2 1 1 1 3 1 1 2 2 1 2 3 3 2 3 1 1 1 1 3 3 1 3 3 1 1 2 3 3 1 2 2 3 3 2 3 2 3 3 2 2 2 1 1 3 3 2 2 1 3 3 2 3 3 1 1 3 2 2 2 1 2 3 1 3 3 3 1 2 2 2 1 1 1 2 2 3 1 1 3 3 1 3 2 3 1 1 1 2 1 3 1 3 3 2 1 1 2 1 1 3 1 1 2 2 3 2 2 2 1 3 3 3 3 3 2 1 1 ...
output:
754 605 5276 265 12917 210 69 4263 11833 610 2550 5415 3601 12242 4287 5965 1729 16708 1764 1028
result:
ok 20 lines
Test #106:
score: 0
Accepted
time: 30ms
memory: 4064kb
input:
50 3286 2 3 1 2 2 1 2 1 2 2 1 1 2 3 2 3 3 1 3 1 1 1 1 3 3 1 3 3 3 1 2 2 2 2 1 1 1 2 3 1 2 1 2 1 2 3 1 3 1 1 1 1 2 1 3 1 2 2 1 2 1 2 3 3 1 2 1 2 1 2 1 2 2 2 2 2 1 2 3 1 2 1 1 3 2 3 1 1 3 2 1 2 1 1 1 2 2 3 1 1 3 1 1 2 2 3 1 2 2 3 2 3 3 2 1 2 3 3 2 3 1 3 2 2 2 3 3 3 1 2 3 3 3 3 2 3 2 1 2 1 2 1 3 1 2 3 ...
output:
1094 2039 1266 311 3566 734 3452 921 6366 1785 1886 46 250 1156 2209 480 856 891 1475 1903 98 1610 6239 2069 1169 4200 1325 2769 31 956 206 4259 6816 2833 474 3248 818 2818 1 398 160 54 1866 4308 3127 5468 1697 282 1209 1567
result:
ok 50 lines
Test #107:
score: 0
Accepted
time: 25ms
memory: 3892kb
input:
100 1 2 8738 3 3 3 2 2 3 2 1 1 2 2 2 3 2 2 1 1 3 2 2 3 2 3 1 3 3 1 3 2 2 1 1 3 2 1 1 3 1 1 1 1 2 2 2 2 1 3 3 2 2 1 2 1 2 1 1 2 2 1 1 2 2 1 2 3 1 1 3 2 2 1 1 3 1 2 3 2 1 3 1 1 1 3 2 1 3 3 3 2 3 3 3 1 2 1 3 3 1 2 3 2 1 3 3 3 3 1 1 3 2 1 1 2 2 2 2 2 1 3 1 2 3 3 3 2 1 3 3 1 3 2 3 2 1 2 3 1 1 2 2 3 3 2 2...
output:
1 2913 447 199 486 258 178 1822 6779 5048 3183 250 179 1857 719 194 98 510 6409 137 388 186 2 85 705 90 155 2627 766 203 413 550 1863 1 515 97 475 1 21 1282 1064 2382 471 276 557 137 112 225 185 921 1869 4 1877 84 353 1369 1175 717 2 507 1358 328 762 525 239 223 49 189 621 1229 427 911 830 2306 3726...
result:
ok 100 lines
Test #108:
score: 0
Accepted
time: 33ms
memory: 3712kb
input:
200 799 2 2 1 1 2 3 3 2 2 2 2 2 1 2 3 3 2 3 3 3 1 3 1 1 2 3 1 3 1 1 3 2 1 3 3 1 3 2 1 1 3 3 1 3 2 1 2 3 3 2 3 3 2 1 2 1 2 2 3 2 1 1 2 1 1 1 1 3 1 2 2 1 3 3 3 3 3 3 2 1 1 3 2 1 2 1 3 1 1 2 3 1 1 1 2 1 1 1 1 1 2 2 3 2 1 2 2 2 2 1 1 3 2 3 2 2 2 2 2 3 2 3 2 2 2 3 2 1 3 3 2 2 3 1 2 2 1 1 1 2 3 1 2 1 3 2 ...
output:
272 219 2 866 1052 234 752 479 66 608 263 503 2073 36 231 1498 315 29 116 514 589 168 905 15 985 18 148 657 2668 1219 580 210 1025 6 41 552 565 181 1702 386 371 154 25 268 2 466 75 151 26 1010 92 700 2157 594 2 1081 168 801 197 157 41 211 902 499 1177 465 101 95 142 500 616 200 51 244 172 630 83 918...
result:
ok 200 lines
Test #109:
score: 0
Accepted
time: 32ms
memory: 3372kb
input:
500 34 2 2 2 2 2 3 3 3 1 2 3 3 1 1 1 2 1 1 3 3 3 3 2 1 3 2 2 2 1 1 3 3 2 1 7 2 1 2 1 1 2 2 333 3 2 1 2 1 1 3 1 1 2 1 2 3 3 3 2 2 1 1 1 1 2 1 3 1 3 1 2 2 2 2 1 3 1 3 3 1 2 3 2 3 1 3 3 3 2 3 1 2 2 1 1 2 3 2 2 3 2 1 3 1 2 1 1 3 1 3 1 2 1 2 2 3 1 1 3 2 2 2 3 2 1 3 1 2 1 3 3 1 3 3 2 2 2 3 2 1 1 3 2 2 3 1...
output:
14 2 124 74 641 27 298 259 91 99 36 568 75 34 164 52 380 59 264 168 88 218 31 89 123 277 23 178 52 439 189 2 162 411 68 1733 348 2 52 354 38 265 10 179 2 80 222 46 298 207 69 547 83 77 117 110 19 414 237 97 111 88 89 36 139 214 266 429 37 629 129 169 42 22 4 84 91 32 231 43 141 168 336 49 40 248 6 4...
result:
ok 500 lines
Test #110:
score: -10
Wrong Answer
time: 40ms
memory: 3328kb
input:
1000 294 3 3 1 1 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 1 2 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 3 1 2 3 1 1 2 3 1 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3...
output:
259 87 166 81 32 102 157 101 53 79 126 39 20 50 17 82 23 41 21 70 95 1 14 38 4 116 52 243 21 136 55 1 1 127 12 59 86 52 106 223 12 6 223 23 12 166 50 11 2 152 51 220 13 59 53 10 174 94 14 333 11 70 89 7 111 5 178 31 89 81 44 25 70 449 7 180 45 122 134 113 138 41 2 1 93 59 21 11 113 55 43 100 12 103 ...
result:
wrong answer 224th lines differ - expected: '2', found: '31'
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #3:
0%
Subtask #7:
score: 0
Skipped
Dependency #1:
0%