QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#87723 | #4929. Longest Unfriendly Subsequence | snpmrnhlol | 0 | 169ms | 21384kb | C++14 | 4.2kb | 2023-03-14 05:34:47 | 2023-03-14 05:34:49 |
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] == 2)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);
//cout<<v[i]<<' ';
//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;
if(dp[v[i]][1].second >= dp[v[i]][0].second)swap(dp[v[i]][1],dp[v[i]][0]);
}
}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;
if(dp[v[i]][1].second >= dp[v[i]][0].second)swap(dp[v[i]][1],dp[v[i]][0]);
}
}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<<v[i]<<' '<<dp[v[i]][0].first<<' '<<dp[v[i]][0].second<<' '<<dp[v[i]][1].first<<' '<<dp[v[i]][1].second<<'\n';
}
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: 65ms
memory: 11944kb
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: 125ms
memory: 21384kb
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: 3376kb
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: 169ms
memory: 3544kb
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 7 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 668th lines differ - expected: '3', found: '6'
Subtask #3:
score: 0
Wrong Answer
Test #19:
score: 8
Accepted
time: 1ms
memory: 3344kb
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: 3444kb
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: 3404kb
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: 2ms
memory: 3380kb
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: 2ms
memory: 3448kb
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: 3388kb
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: 0
Accepted
time: 2ms
memory: 3400kb
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 230 33
result:
ok 3 lines
Test #26:
score: 0
Accepted
time: 2ms
memory: 3508kb
input:
3 113 89789132 548906728 545868627 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 5458...
output:
101 127 137
result:
ok 3 lines
Test #27:
score: 0
Accepted
time: 2ms
memory: 3484kb
input:
3 108 794907019 802850140 730657927 730657927 794907019 794907019 802850140 730657927 794907019 802850140 730657927 794907019 794907019 802850140 802850140 730657927 794907019 802850140 730657927 730657927 794907019 802850140 802850140 802850140 802850140 730657927 794907019 802850140 730657927 7306...
output:
78 71 236
result:
ok 3 lines
Test #28:
score: 0
Accepted
time: 0ms
memory: 3372kb
input:
3 55 382906854 86510837 1801762 382906854 86510837 1801762 382906854 382906854 578362690 1801762 382906854 86510837 1801762 382906854 86510837 1801762 1801762 382906854 86510837 1801762 382906854 86510837 1801762 382906854 86510837 1801762 382906854 86510837 382906854 1801762 86510837 382906854 1801...
output:
43 81 289
result:
ok 3 lines
Test #29:
score: 0
Accepted
time: 2ms
memory: 3516kb
input:
20 38 68789463 462582466 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 536943437 68789463 279061055 5369...
output:
32 18 20 76 24 7 5 9 5 42 34 25 14 4 10 29 8 16 31 9
result:
ok 20 lines
Test #30:
score: -8
Wrong Answer
time: 1ms
memory: 3364kb
input:
100 8 594931073 674884200 594931073 960542002 674884200 594931073 404937349 674884200 3 28762160 795234252 28762160 6 693736695 693736695 515596726 693736695 568079150 515596726 2 508417829 600345257 4 637967683 731409954 197653780 548314174 9 493559887 493559887 995798571 234632692 493559887 995798...
output:
7 2 4 2 4 7 3 3 5 1 8 1 5 3 1 1 3 5 3 10 3 1 3 6 4 5 5 1 6 2 2 6 9 9 2 7 5 5 8 1 7 11 13 4 6 12 1 1 5 2 4 8 1 1 9 9 1 11 3 14 3 4 1 2 2 4 2 5 4 6 5 9 3 2 5 1 5 9 1 10 3 19 7 2 2 5 1 15 1 1 6 11 1 1 3 1 2 5 8 4
result:
wrong answer 9th lines differ - expected: '3', found: '5'
Subtask #4:
score: 0
Wrong Answer
Test #79:
score: 10
Accepted
time: 32ms
memory: 12012kb
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: 30ms
memory: 11944kb
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: 35ms
memory: 12120kb
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: 30ms
memory: 11948kb
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: 12124kb
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: 30ms
memory: 11912kb
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: 24ms
memory: 12056kb
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: 29ms
memory: 11940kb
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: 33ms
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: 31ms
memory: 8184kb
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: 34ms
memory: 8564kb
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: 26ms
memory: 8148kb
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: 30ms
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: 31ms
memory: 12128kb
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: 24ms
memory: 12120kb
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: 34ms
memory: 11964kb
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: 36ms
memory: 12012kb
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: 29ms
memory: 12096kb
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: 32ms
memory: 12096kb
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: 31ms
memory: 11964kb
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: 35ms
memory: 8752kb
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: 26ms
memory: 8144kb
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: 29ms
memory: 7368kb
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: 30ms
memory: 7356kb
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: 35ms
memory: 6216kb
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: 29ms
memory: 5072kb
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: 23ms
memory: 4872kb
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: 33ms
memory: 4336kb
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: 34ms
memory: 3980kb
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: 27ms
memory: 3748kb
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: 29ms
memory: 3468kb
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: 29ms
memory: 3420kb
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%