QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#863781 | #9907. 最大匹配 2 | thangthang# | 45 | 28ms | 9464kb | C++20 | 1.3kb | 2025-01-19 22:18:37 | 2025-01-19 22:18:38 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, m, a[N], b[N], used[N];
vector <int> pos[N];
void solve(){
int ans = 0;
for (int i = 1; i <= n; ++ i) pos[i].clear(), pos[i].clear();
for (int i = 1; i <= n; ++ i){
pos[a[i]].push_back(i);
used[i] = 0;
}
for (int v = 1; v <= n; v ++){
vector <int> stk;
for (int p : pos[v]){
if (!b[p]) stk.push_back(p);
else if (stk.size()){
int q = stk.back(); stk.pop_back();
ans ++;
used[p] = 1, used[q] = 1;
}
}
}
vector <int> stk;
for (int p = 1; p <= n; p ++) if (!used[p]){
if (!b[p]) stk.push_back(p);
else if (stk.size()){
int q = stk.back(); stk.pop_back();
ans ++;
used[p] = 1, used[q] = 1;
}
}
cout << ans << "\n";
}
void process(){
cin >> n >> m;
for (int i = 1; i <= n; ++ i) cin >> a[i];
for (int i = 1; i <= n; ++ i) cin >> b[i];
solve();
while (m --){
int i, p, q; cin >> i >> p >> q;
a[i] = p, b[i] = q;
solve();
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
process();
return 0;
}
详细
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 7908kb
input:
100 0 1 1 2 1 2 2 2 2 2 1 2 1 1 2 2 1 2 2 2 2 2 1 1 2 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 1 1 2 1 2 1 1 1 2 2 2 2 2 2 1 1 1 2 1 1 1 1 1 2 2 1 1 2 1 1 2 1 1 2 2 2 1 2 2 2 1 2 1 2 1 2 1 1 2 1 1 2 1 1 0 1 0 0 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 0 1 0 0 0 1 1 0 0 0 0 0 1 1 0 1 1 0 0 0 0 1 1 1 1 1 ...
output:
45
result:
ok "45"
Test #2:
score: 10
Accepted
time: 0ms
memory: 5860kb
input:
100 0 2 1 1 2 1 2 1 2 1 1 1 2 1 1 2 1 1 2 2 1 2 1 2 2 1 1 2 2 1 1 1 2 1 1 1 2 2 1 2 1 1 2 2 2 2 2 1 2 1 2 2 1 1 2 1 2 2 1 1 2 2 1 1 1 2 2 1 2 1 2 1 2 2 2 1 2 1 1 2 2 2 2 1 1 1 1 1 1 1 2 2 1 2 1 2 2 2 2 1 2 0 0 0 1 1 1 1 1 0 1 1 0 1 0 0 1 1 1 1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 1 0 0 1 1 0 1 1 0 1 1 1 1 0 ...
output:
43
result:
ok "43"
Test #3:
score: 10
Accepted
time: 0ms
memory: 5872kb
input:
100 0 2 2 3 3 4 4 3 2 4 4 1 2 3 4 3 4 4 3 3 2 3 1 2 4 1 3 1 4 3 3 4 4 3 3 1 4 1 1 2 2 1 3 4 3 3 4 3 3 4 3 4 3 4 4 1 1 1 4 3 1 2 1 2 3 3 3 2 1 1 1 1 3 3 2 4 2 3 4 1 4 1 4 1 1 2 1 1 1 1 1 4 4 2 3 2 1 2 3 1 4 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 0 1 0 0 0 1 0 1 1 0 0 1 0 1 1 1 1 0 1 1 1 0 1 0 1 1 1 0 0 1 ...
output:
37
result:
ok "37"
Test #4:
score: 10
Accepted
time: 0ms
memory: 7912kb
input:
100 0 3 1 2 4 3 2 2 1 4 2 2 3 2 1 1 2 3 3 2 3 1 1 3 4 3 2 1 2 4 3 4 2 2 1 2 4 2 2 1 1 3 3 1 2 3 4 3 2 3 2 2 1 3 3 1 2 3 2 2 3 3 4 2 2 1 4 1 3 2 3 3 4 4 3 2 1 4 2 2 3 4 2 3 2 3 4 3 3 1 2 3 4 3 1 4 1 2 2 2 3 1 0 1 1 0 1 1 0 0 0 0 0 0 1 1 1 0 1 1 0 0 0 0 1 0 1 0 0 0 1 1 1 0 0 1 1 0 0 1 1 1 0 0 0 0 0 0 ...
output:
44
result:
ok "44"
Test #5:
score: 10
Accepted
time: 1ms
memory: 5864kb
input:
100 0 3 6 4 7 5 4 7 5 1 1 6 8 5 5 6 7 3 6 3 3 7 5 6 4 8 4 6 4 8 3 8 6 6 6 3 6 2 7 7 1 2 7 3 8 4 8 2 8 4 5 4 2 2 1 6 1 1 8 2 1 4 4 1 1 5 6 2 3 2 6 1 5 2 6 7 8 6 5 7 1 7 1 8 1 8 6 3 6 3 7 1 3 3 8 8 4 5 7 1 5 0 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 0 1 0 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 ...
output:
37
result:
ok "37"
Test #6:
score: 10
Accepted
time: 0ms
memory: 5860kb
input:
100 0 3 5 6 3 4 8 4 1 3 7 6 7 2 8 2 2 2 4 1 1 1 8 8 7 6 2 6 7 1 3 1 3 2 2 5 2 2 7 2 8 5 3 5 4 1 6 8 8 4 5 3 6 3 6 2 7 1 6 1 3 3 2 6 8 4 2 6 6 4 5 5 4 4 8 3 3 2 7 1 7 4 6 3 3 8 8 1 7 4 1 8 8 7 1 4 7 7 7 3 2 0 0 0 1 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1 1 1 0 1 1 0 1 1 1 0 0 1 1 1 1 1 1 0 0 1 0 0 0 1 1 1 ...
output:
39
result:
ok "39"
Test #7:
score: 10
Accepted
time: 0ms
memory: 5820kb
input:
100 0 16 4 8 15 14 16 12 2 9 6 2 2 14 5 16 9 11 1 11 4 12 9 7 2 13 1 11 8 5 12 4 7 16 7 14 14 4 10 16 6 13 16 8 11 9 4 2 8 4 12 12 13 15 7 11 15 6 15 15 11 14 7 15 14 11 6 2 11 11 3 6 11 9 4 11 15 10 16 16 9 15 4 14 10 12 16 16 11 1 1 7 5 11 12 10 2 13 14 9 1 1 1 0 1 1 1 1 1 0 1 0 1 0 1 1 1 1 1 0 0 ...
output:
37
result:
ok "37"
Test #8:
score: 10
Accepted
time: 0ms
memory: 5868kb
input:
100 0 2 1 14 11 15 16 8 12 1 13 3 8 7 8 16 3 2 10 3 16 5 11 10 11 8 1 15 10 2 16 6 12 13 9 10 16 12 8 3 11 6 14 12 11 12 12 6 6 16 5 9 5 7 13 5 7 3 14 1 13 13 4 6 8 3 4 9 3 1 13 16 12 6 2 15 5 3 12 6 13 13 8 7 5 13 6 2 3 15 7 10 2 4 15 5 9 15 2 9 9 1 0 1 1 0 1 1 1 1 1 1 1 0 0 1 1 1 1 0 1 1 1 1 0 1 0...
output:
35
result:
ok "35"
Test #9:
score: 10
Accepted
time: 1ms
memory: 5692kb
input:
100 0 3 21 1 30 24 27 22 30 2 12 14 13 24 4 6 14 29 1 8 29 16 21 27 18 9 20 2 1 17 7 13 19 12 16 17 27 1 2 27 1 2 5 13 21 24 14 26 19 29 18 19 4 28 31 23 25 8 21 2 24 19 17 2 7 14 13 8 16 24 29 13 1 30 28 9 25 24 10 22 6 19 20 26 32 1 1 5 19 22 31 19 21 10 25 16 17 20 1 7 22 0 1 0 1 1 1 0 1 0 1 0 1 ...
output:
38
result:
ok "38"
Test #10:
score: 10
Accepted
time: 0ms
memory: 5864kb
input:
100 0 24 32 27 20 31 21 25 9 18 31 9 8 25 7 12 31 27 13 9 11 18 15 29 19 18 1 29 28 29 21 13 10 1 11 18 32 10 20 17 6 7 29 16 13 5 19 13 5 14 22 26 29 27 23 5 29 10 32 5 26 19 27 6 29 2 2 16 12 23 23 2 8 27 12 28 31 31 18 31 26 20 13 29 21 19 3 2 27 32 10 28 7 20 16 30 2 10 11 9 10 0 1 0 1 1 1 0 0 1...
output:
44
result:
ok "44"
Subtask #2:
score: 15
Accepted
Test #11:
score: 15
Accepted
time: 1ms
memory: 5744kb
input:
2000 0 2 2 1 1 2 1 2 2 2 1 1 1 2 1 2 2 1 2 2 1 2 1 2 1 1 2 1 2 2 1 2 2 2 1 1 1 1 1 1 2 1 1 2 2 1 2 1 2 2 2 1 1 2 1 1 1 2 2 2 2 2 2 1 1 2 1 1 2 2 1 2 1 1 1 1 2 1 1 1 1 1 2 2 2 2 1 2 2 1 2 2 2 2 2 1 2 1 2 1 1 2 1 1 2 2 1 1 1 1 1 1 1 1 2 2 1 2 2 2 2 2 1 1 2 2 2 2 1 2 2 2 1 1 1 2 1 2 1 1 1 2 2 1 2 1 1 1...
output:
954
result:
ok "954"
Test #12:
score: 15
Accepted
time: 2ms
memory: 7912kb
input:
2000 0 2 1 1 1 1 1 2 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 2 2 1 2 1 1 1 1 1 1 1 2 2 1 2 2 1 1 2 2 2 2 1 2 2 2 2 1 1 2 2 1 1 1 2 2 1 2 1 2 2 2 1 2 2 1 2 2 2 2 2 1 2 1 2 2 1 2 2 1 1 1 1 1 2 2 1 2 1 2 1 2 1 1 1 2 2 2 1 2 1 1 2 1 2 1 1 1 1 1 2 1 2 1 2 2 2 2 1 2 1 1 2 2 2 2 1 1 2 2 1 1 2 1 2 2 2...
output:
958
result:
ok "958"
Test #13:
score: 15
Accepted
time: 0ms
memory: 5712kb
input:
2000 0 4 3 4 4 2 2 2 2 3 1 1 3 1 3 3 3 1 4 2 2 2 4 4 3 3 3 1 1 3 1 2 1 2 1 1 4 1 2 2 4 3 3 1 3 2 2 1 3 2 1 3 4 3 2 3 4 3 1 3 2 2 1 4 2 4 4 3 4 1 3 3 1 3 1 3 1 4 3 4 4 4 3 4 1 3 2 4 3 4 3 1 3 2 4 1 4 2 1 2 2 4 4 1 4 2 4 1 1 1 2 1 1 4 1 1 2 2 1 4 2 2 3 4 2 2 3 1 4 1 1 2 2 1 3 2 1 3 2 3 3 1 1 2 4 1 1 4...
output:
946
result:
ok "946"
Test #14:
score: 15
Accepted
time: 0ms
memory: 5724kb
input:
2000 0 1 2 4 3 3 3 2 3 1 4 4 1 4 4 1 2 3 4 2 3 1 2 1 4 3 4 3 3 4 3 4 4 1 4 4 2 4 4 2 1 2 3 2 3 2 4 2 2 3 4 3 3 4 3 4 4 4 4 2 2 4 3 4 3 1 3 3 2 2 2 4 3 1 1 2 1 2 2 2 1 1 2 1 4 2 3 4 1 4 1 1 4 1 2 1 1 4 4 3 2 4 1 2 1 1 1 1 2 4 2 2 3 4 1 1 4 2 2 4 3 3 1 2 3 2 1 4 2 2 1 4 2 2 4 3 3 1 2 2 3 4 3 1 4 3 1 1...
output:
945
result:
ok "945"
Test #15:
score: 15
Accepted
time: 1ms
memory: 5708kb
input:
2000 0 1 7 4 2 3 5 8 1 8 6 3 8 4 2 5 5 1 1 5 2 5 7 6 6 1 5 3 5 1 3 6 4 8 4 3 7 1 7 6 2 4 6 6 1 2 5 2 7 8 8 6 6 8 6 3 3 3 6 1 4 7 3 5 5 6 3 5 5 7 5 3 7 7 3 4 2 8 1 4 2 7 4 8 7 1 3 1 6 1 1 3 5 6 3 2 7 8 2 6 2 8 2 7 8 4 3 3 2 1 4 7 7 6 1 3 6 7 1 8 7 8 6 6 4 1 5 4 4 5 8 7 2 5 8 6 2 5 6 5 2 6 3 6 1 3 3 3...
output:
947
result:
ok "947"
Test #16:
score: 15
Accepted
time: 1ms
memory: 7912kb
input:
2000 0 6 6 5 4 2 5 4 5 2 7 1 7 3 6 4 4 4 1 2 5 6 8 4 1 3 8 4 6 2 1 6 1 1 1 2 4 6 2 2 6 7 1 4 6 2 4 1 7 2 5 8 2 2 2 3 8 4 3 5 8 7 8 3 8 4 6 5 8 4 1 6 6 6 2 3 8 5 7 4 3 4 1 1 5 3 6 6 8 1 5 6 8 4 7 2 2 3 2 1 4 7 1 2 6 7 1 2 6 1 1 2 1 7 1 8 7 8 6 8 1 5 8 2 1 2 7 4 4 3 8 3 6 1 8 4 6 4 1 3 6 4 5 4 6 7 3 4...
output:
948
result:
ok "948"
Test #17:
score: 15
Accepted
time: 0ms
memory: 7916kb
input:
2000 0 14 5 12 9 15 8 12 9 13 3 15 8 16 5 5 10 15 7 6 14 4 15 4 9 3 8 13 3 1 16 11 5 15 7 6 7 9 3 11 10 4 10 1 3 10 3 3 9 16 16 2 10 3 7 8 9 14 13 14 1 11 3 2 14 14 5 9 13 2 7 7 9 16 3 16 6 10 13 4 9 1 13 8 15 6 9 14 2 6 8 9 6 1 5 16 12 1 4 13 3 11 16 15 13 6 8 16 10 5 6 11 1 12 10 2 6 2 13 2 13 3 1...
output:
949
result:
ok "949"
Test #18:
score: 15
Accepted
time: 0ms
memory: 5880kb
input:
2000 0 5 10 9 2 5 16 16 8 5 15 7 5 2 6 12 8 7 7 3 4 14 2 9 7 8 12 11 10 3 9 14 2 10 13 7 12 8 8 14 8 14 11 6 1 15 10 11 7 4 11 11 2 9 9 16 4 3 4 5 8 13 9 8 16 1 1 8 15 11 11 12 8 9 9 7 13 16 9 10 8 6 6 13 11 1 3 14 6 3 12 10 6 10 16 1 4 16 16 7 13 10 8 1 11 11 9 12 16 7 12 2 3 15 13 3 1 10 14 13 16 ...
output:
928
result:
ok "928"
Test #19:
score: 15
Accepted
time: 0ms
memory: 7784kb
input:
2000 0 5 23 28 22 6 12 21 25 32 19 4 15 7 10 16 28 29 32 5 6 28 21 14 9 7 23 31 8 3 12 8 16 29 17 18 8 32 9 27 27 27 4 22 11 11 7 10 16 12 29 23 15 6 25 31 3 1 23 10 20 16 11 8 23 1 9 3 12 3 8 31 24 4 8 7 5 10 21 16 19 14 31 28 9 14 27 5 28 3 30 8 21 32 22 23 10 9 14 20 22 3 2 28 19 12 20 4 7 29 1 5...
output:
950
result:
ok "950"
Test #20:
score: 15
Accepted
time: 0ms
memory: 5872kb
input:
2000 0 20 17 13 28 19 28 19 12 16 15 8 32 3 1 21 10 13 16 28 16 11 2 3 28 4 26 31 15 7 13 10 5 19 10 1 22 20 13 10 9 25 6 8 10 27 32 10 25 31 22 11 31 7 9 12 8 32 21 2 25 20 1 11 10 28 2 5 32 30 29 3 30 13 28 29 13 29 10 18 20 5 19 21 9 2 29 7 19 11 22 12 27 30 30 8 18 31 32 11 10 23 29 19 3 10 32 2...
output:
918
result:
ok "918"
Test #21:
score: 15
Accepted
time: 1ms
memory: 5732kb
input:
2000 0 29 39 61 16 16 45 3 35 24 19 61 12 42 36 49 32 58 54 27 17 11 47 59 3 47 37 41 13 30 39 37 46 60 48 9 63 12 3 8 3 49 9 26 64 36 42 56 47 33 54 40 47 19 17 48 56 44 38 32 61 15 51 7 11 57 19 15 22 42 2 23 19 48 28 47 55 34 49 9 21 56 38 63 29 5 25 30 62 49 62 21 58 59 3 19 4 61 4 48 45 33 6 14...
output:
909
result:
ok "909"
Test #22:
score: 15
Accepted
time: 1ms
memory: 5724kb
input:
2000 0 28 13 36 62 2 58 55 9 2 14 56 45 12 61 21 52 29 6 12 48 20 43 37 41 7 47 64 23 15 12 7 42 15 31 43 7 64 30 11 3 7 17 13 46 49 6 47 10 55 17 33 37 9 52 63 28 45 27 25 53 55 51 34 23 41 31 18 11 31 37 18 45 45 31 27 58 29 12 16 44 19 45 64 55 7 20 31 27 34 35 11 63 57 17 2 34 1 54 20 37 55 4 11...
output:
900
result:
ok "900"
Test #23:
score: 15
Accepted
time: 0ms
memory: 5740kb
input:
2000 0 31 104 15 67 66 31 37 55 12 115 95 50 47 3 115 11 25 8 40 43 117 107 99 3 9 75 111 115 74 97 24 8 16 86 71 59 43 25 63 121 125 19 109 83 105 62 20 65 17 57 47 51 69 18 114 18 97 96 114 5 68 74 125 5 33 85 75 73 110 75 95 104 104 28 127 89 22 30 88 9 69 43 110 32 104 1 116 52 127 121 35 15 85 ...
output:
872
result:
ok "872"
Test #24:
score: 15
Accepted
time: 0ms
memory: 5760kb
input:
2000 0 11 44 53 57 20 98 36 75 12 56 9 94 7 128 42 27 3 95 19 97 109 35 114 115 4 9 34 104 63 29 65 60 50 36 98 53 67 12 117 75 116 78 45 36 78 48 63 23 121 16 126 12 112 78 100 60 44 48 85 108 3 38 94 21 67 54 14 116 27 50 114 68 17 3 81 64 96 5 50 65 33 122 102 100 33 101 44 114 66 80 99 44 121 11...
output:
883
result:
ok "883"
Test #25:
score: 15
Accepted
time: 1ms
memory: 5892kb
input:
2000 0 212 40 232 87 79 203 233 171 143 9 124 97 47 54 250 185 169 100 244 253 120 131 85 195 8 234 73 7 171 247 118 184 64 132 82 42 64 116 53 137 155 33 87 164 160 6 168 102 125 31 63 39 229 76 16 65 100 244 26 83 73 232 85 146 135 196 233 175 96 240 214 248 208 164 128 8 29 60 103 140 214 151 114...
output:
852
result:
ok "852"
Test #26:
score: 15
Accepted
time: 0ms
memory: 7916kb
input:
2000 0 228 227 120 56 250 38 238 224 14 1 239 70 20 90 235 248 114 33 47 210 111 244 218 72 51 144 243 191 168 149 165 105 89 224 147 217 17 46 79 207 48 94 182 80 209 145 45 40 47 255 3 118 55 96 6 172 35 130 26 116 40 68 68 102 184 92 10 94 52 66 53 237 6 189 28 16 106 208 50 33 68 24 249 191 102 ...
output:
863
result:
ok "863"
Test #27:
score: 15
Accepted
time: 0ms
memory: 5896kb
input:
2000 0 510 427 155 433 37 348 174 418 481 8 170 485 274 110 187 213 285 60 125 460 135 101 299 75 83 33 268 169 125 472 46 363 60 155 232 365 4 213 384 468 6 404 133 201 483 251 129 319 129 505 71 261 251 76 460 122 65 387 507 149 432 372 200 243 499 394 440 239 284 93 298 154 35 416 156 474 494 116...
output:
866
result:
ok "866"
Test #28:
score: 15
Accepted
time: 1ms
memory: 5868kb
input:
2000 0 354 297 56 124 319 256 97 329 474 344 18 227 225 116 272 259 287 6 411 222 281 145 104 62 84 239 320 231 424 262 323 232 278 142 84 288 11 323 322 482 405 108 223 168 381 137 191 8 15 466 220 360 450 109 109 243 226 340 504 102 371 197 219 6 174 248 314 401 4 396 69 179 158 18 294 197 412 498...
output:
864
result:
ok "864"
Test #29:
score: 15
Accepted
time: 0ms
memory: 5748kb
input:
2000 0 393 713 332 785 736 132 371 355 885 858 647 475 461 236 796 95 786 256 736 260 862 1020 895 868 364 1018 75 856 217 269 567 759 553 133 647 397 651 167 171 651 1006 5 833 305 300 578 438 242 790 902 810 973 625 232 838 205 231 796 453 274 851 632 111 269 885 482 875 156 558 218 384 382 110 75...
output:
859
result:
ok "859"
Test #30:
score: 15
Accepted
time: 1ms
memory: 5736kb
input:
2000 0 836 681 896 743 896 179 455 358 975 7 681 109 434 847 226 878 352 835 665 569 694 543 35 103 719 764 921 671 739 70 972 467 1001 835 613 209 593 617 940 69 170 622 651 981 309 191 492 513 811 909 74 527 511 222 565 304 415 17 695 332 474 237 519 568 118 86 22 185 174 690 977 404 502 600 965 6...
output:
889
result:
ok "889"
Subtask #3:
score: 20
Accepted
Test #31:
score: 20
Accepted
time: 15ms
memory: 6764kb
input:
200000 0 1 2 2 2 2 2 2 1 1 2 2 1 1 1 2 1 1 1 2 1 2 1 1 1 2 1 1 1 1 2 2 2 2 2 1 2 2 1 2 1 1 2 2 2 2 1 2 2 1 2 1 1 2 1 1 2 1 2 2 1 2 2 2 1 1 2 1 1 1 2 2 2 2 1 1 2 2 1 1 2 1 2 2 2 2 2 1 1 2 2 2 2 1 2 1 2 2 2 1 2 2 2 2 1 2 2 2 1 1 1 2 2 1 2 2 2 1 1 1 1 1 2 1 2 1 2 1 2 1 2 1 2 2 1 2 2 2 1 1 1 2 1 2 1 1 1...
output:
99478
result:
ok "99478"
Test #32:
score: 20
Accepted
time: 15ms
memory: 6764kb
input:
200000 0 1 2 2 2 2 2 1 1 2 1 2 1 1 1 2 2 2 2 2 1 1 1 2 2 2 1 1 2 2 1 2 2 2 2 1 2 1 1 2 1 1 2 2 2 2 2 1 2 1 2 1 2 1 1 2 1 1 2 1 2 1 2 2 1 1 1 1 1 1 1 1 2 2 1 2 2 1 1 2 2 2 2 2 2 2 1 2 1 1 1 2 2 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 2 2 1 1 1 2 1 1 1 1 1 2 1 2 1 2 2 2 1 1 2 1 2 1 2 2 2 2 1 1 1 1 2 1 1 2 2 1 1...
output:
99594
result:
ok "99594"
Test #33:
score: 20
Accepted
time: 15ms
memory: 6928kb
input:
200000 0 2 4 1 2 1 3 3 1 3 1 4 4 4 3 3 4 1 3 2 2 3 1 4 2 2 2 3 2 4 2 2 1 3 1 1 1 1 3 1 2 2 3 3 1 2 1 4 4 1 1 2 1 3 4 3 4 4 3 1 3 4 2 4 3 3 2 4 4 1 2 1 4 2 1 1 2 2 3 2 2 1 4 2 3 3 1 3 1 2 3 4 3 4 1 2 2 1 3 3 2 1 2 3 1 2 1 3 3 2 1 3 1 3 3 3 4 4 3 3 2 2 3 2 2 1 2 3 1 3 4 1 1 4 2 1 4 4 3 3 3 2 2 3 4 1 2...
output:
99667
result:
ok "99667"
Test #34:
score: 20
Accepted
time: 14ms
memory: 7672kb
input:
200000 0 3 4 3 3 3 3 2 3 2 1 4 2 2 1 3 2 1 3 4 4 4 4 2 1 4 4 3 3 4 3 4 4 4 3 4 4 1 1 2 1 1 1 4 1 1 1 3 4 2 4 1 2 4 1 2 2 3 1 1 4 4 2 3 1 3 2 4 3 1 4 4 4 2 4 4 1 4 4 3 3 4 1 1 1 1 2 3 4 1 2 1 4 2 2 2 2 1 2 1 1 2 2 2 2 2 1 4 1 2 3 3 2 2 1 1 4 2 2 2 1 4 2 2 2 3 2 2 4 1 1 1 3 4 4 4 2 2 4 3 3 3 4 4 2 3 2...
output:
99643
result:
ok "99643"
Test #35:
score: 20
Accepted
time: 16ms
memory: 6892kb
input:
200000 0 4 5 7 2 7 1 1 5 8 8 6 7 1 2 6 2 6 4 5 8 2 8 7 1 5 4 2 7 1 4 4 7 4 7 1 5 6 8 6 8 8 2 7 6 6 5 8 3 7 2 8 5 1 7 1 3 3 2 1 7 8 7 1 4 4 8 3 8 5 2 2 5 5 4 8 6 5 2 8 7 4 8 3 7 5 8 5 1 5 8 8 2 8 5 2 7 7 1 7 4 5 1 7 6 3 1 4 6 7 3 8 5 3 6 1 4 3 7 2 6 8 6 3 3 2 6 8 8 2 3 8 7 5 4 8 4 8 6 4 1 1 1 8 8 7 2...
output:
99389
result:
ok "99389"
Test #36:
score: 20
Accepted
time: 15ms
memory: 7016kb
input:
200000 0 5 2 5 6 7 3 3 3 8 4 2 1 6 1 2 4 1 6 2 1 4 8 6 2 7 6 3 6 6 3 3 1 5 5 7 4 8 4 8 7 2 3 4 3 2 4 6 8 1 1 8 7 8 7 7 4 8 6 6 3 1 1 1 6 2 3 1 4 5 8 4 4 5 6 2 5 3 5 7 1 8 5 7 4 6 3 8 8 2 7 2 3 2 8 4 2 7 4 2 2 5 8 1 7 3 7 3 1 4 5 3 5 6 5 7 8 1 6 3 1 3 2 6 5 8 8 1 8 3 7 4 7 5 4 3 2 7 6 1 4 8 1 1 1 6 6...
output:
99441
result:
ok "99441"
Test #37:
score: 20
Accepted
time: 16ms
memory: 7800kb
input:
200000 0 15 3 12 7 12 12 5 3 10 14 14 8 1 2 3 2 12 7 1 6 6 6 6 2 14 10 5 9 15 6 6 8 3 5 15 7 11 15 3 3 11 16 1 15 14 16 6 5 7 14 13 1 8 3 10 14 12 6 14 5 13 6 7 15 13 3 10 3 1 16 10 13 1 15 11 15 14 3 9 2 16 8 7 8 10 11 12 4 13 9 9 14 7 16 6 2 9 6 11 12 8 3 1 10 2 9 8 4 15 6 9 16 10 14 14 13 7 11 5 ...
output:
99045
result:
ok "99045"
Test #38:
score: 20
Accepted
time: 16ms
memory: 7016kb
input:
200000 0 2 2 2 16 7 16 10 6 9 16 1 2 10 2 12 3 9 6 9 14 14 14 14 7 9 8 2 9 14 3 16 7 16 16 16 16 8 2 15 5 6 9 10 3 14 3 1 11 3 1 8 8 8 4 8 8 5 13 5 10 3 13 8 11 9 2 2 14 14 4 7 2 15 5 8 13 16 13 2 9 5 1 4 13 14 4 11 12 2 12 13 11 5 10 8 9 1 11 10 15 2 1 5 3 12 14 15 1 9 9 11 1 8 16 11 5 2 15 8 1 16 ...
output:
99156
result:
ok "99156"
Test #39:
score: 20
Accepted
time: 17ms
memory: 6784kb
input:
200000 0 24 17 28 31 26 22 27 6 1 2 25 16 28 13 12 21 22 8 15 10 16 17 2 28 27 13 16 3 14 32 9 9 6 8 18 20 18 9 11 22 26 27 11 18 13 32 6 23 31 19 28 2 30 8 32 4 20 15 7 10 2 23 21 7 10 15 11 32 10 18 21 20 24 9 25 30 28 17 3 14 11 3 28 2 5 28 11 9 17 17 26 17 2 13 32 26 13 11 31 3 15 23 29 23 11 29...
output:
98956
result:
ok "98956"
Test #40:
score: 20
Accepted
time: 15ms
memory: 7760kb
input:
200000 0 16 15 2 2 19 17 4 1 11 16 16 2 29 26 1 31 13 4 1 10 9 11 1 23 10 18 8 21 10 26 5 10 19 27 4 8 29 25 8 18 15 2 32 30 8 11 16 24 15 8 14 29 10 17 4 32 2 31 7 13 27 29 23 20 26 3 21 3 18 16 19 17 20 25 5 21 21 12 1 23 3 5 24 3 22 26 3 19 8 10 9 6 7 22 6 16 31 4 23 12 8 6 20 19 6 13 8 29 2 11 2...
output:
98991
result:
ok "98991"
Test #41:
score: 20
Accepted
time: 16ms
memory: 7676kb
input:
200000 0 18 41 7 17 44 19 29 6 33 4 47 6 6 20 62 61 62 11 26 30 7 40 64 10 16 3 36 4 58 14 63 34 56 47 17 30 7 51 41 47 51 49 3 25 55 31 11 47 64 24 19 20 35 20 59 55 63 11 9 38 57 44 44 43 1 12 34 38 61 26 54 55 31 6 50 56 23 52 22 48 61 17 41 15 56 51 40 6 49 63 36 23 49 33 1 16 39 52 53 62 46 58 ...
output:
98641
result:
ok "98641"
Test #42:
score: 20
Accepted
time: 17ms
memory: 6892kb
input:
200000 0 43 22 32 51 60 34 58 47 26 19 5 37 4 13 24 31 61 57 28 29 41 3 8 41 35 22 54 43 62 47 59 51 56 4 27 64 31 9 52 34 11 26 52 10 61 54 57 34 4 50 6 42 33 27 12 31 32 23 23 34 11 46 7 38 50 54 45 42 5 43 49 51 29 26 32 38 59 10 26 52 47 23 42 8 5 32 26 34 43 34 4 58 25 49 10 10 13 21 34 28 21 3...
output:
98919
result:
ok "98919"
Test #43:
score: 20
Accepted
time: 16ms
memory: 7928kb
input:
200000 0 98 94 35 1 96 18 110 109 11 50 90 115 51 92 66 28 122 92 100 66 24 3 83 62 82 58 7 14 91 42 78 127 94 53 41 60 9 78 119 52 49 77 72 102 45 116 105 33 7 15 73 77 111 120 16 54 43 31 83 58 51 82 99 94 90 113 5 5 117 44 9 51 122 16 122 78 6 62 95 22 73 34 13 61 67 64 100 2 79 17 114 104 29 90 ...
output:
98081
result:
ok "98081"
Test #44:
score: 20
Accepted
time: 17ms
memory: 7420kb
input:
200000 0 126 5 109 42 49 64 125 115 1 9 126 93 109 32 14 49 128 33 89 85 57 32 83 68 50 71 126 127 100 61 96 46 60 35 16 40 94 20 120 114 71 94 5 48 17 9 11 109 98 22 91 46 51 48 14 24 125 74 66 35 89 30 45 66 32 56 36 99 65 7 49 127 58 94 26 50 45 84 84 125 72 38 106 76 99 6 10 80 33 40 113 57 49 1...
output:
98265
result:
ok "98265"
Test #45:
score: 20
Accepted
time: 15ms
memory: 7388kb
input:
200000 0 185 162 150 140 42 147 34 92 222 116 202 249 98 69 37 118 84 184 191 153 172 191 233 209 81 228 247 148 141 130 218 215 122 138 73 248 224 31 25 99 182 243 202 17 166 45 106 2 1 240 137 32 217 67 18 58 233 166 111 83 42 225 64 12 128 173 143 144 218 166 188 218 140 191 136 184 201 86 173 72...
output:
97671
result:
ok "97671"
Test #46:
score: 20
Accepted
time: 16ms
memory: 8184kb
input:
200000 0 159 14 60 165 77 36 205 90 212 219 236 207 192 83 166 52 196 42 245 11 214 189 206 242 70 190 13 93 2 83 31 114 157 38 97 79 1 16 203 53 40 208 108 242 214 191 237 160 77 214 130 228 171 235 24 154 228 196 96 26 72 52 30 233 249 60 150 219 111 24 131 243 255 73 124 180 175 57 111 196 131 18...
output:
97706
result:
ok "97706"
Test #47:
score: 20
Accepted
time: 18ms
memory: 7728kb
input:
200000 0 232 360 98 161 71 183 249 330 303 263 492 137 124 415 353 376 421 135 128 31 342 510 225 233 371 279 312 37 396 59 382 43 20 206 307 338 311 423 454 478 241 204 389 65 35 512 503 357 95 258 490 63 299 39 371 105 230 181 456 343 453 476 389 3 40 291 335 11 366 201 58 19 221 185 21 381 322 25...
output:
96826
result:
ok "96826"
Test #48:
score: 20
Accepted
time: 18ms
memory: 7396kb
input:
200000 0 341 444 28 12 172 427 315 420 447 449 401 134 473 397 180 63 272 127 287 230 174 175 481 27 388 394 70 146 481 100 483 44 282 292 81 266 432 265 433 507 216 436 442 50 173 216 59 284 385 285 100 137 240 407 298 482 234 455 246 231 428 6 441 471 29 305 285 494 228 395 463 203 238 404 16 119 ...
output:
97015
result:
ok "97015"
Test #49:
score: 20
Accepted
time: 19ms
memory: 7760kb
input:
200000 0 278 461 46 824 614 834 662 290 378 214 72 575 616 29 696 513 704 78 554 776 991 152 221 21 278 284 920 163 867 70 602 248 250 932 671 975 950 226 957 437 767 205 396 480 304 562 993 785 1000 276 861 263 250 737 958 185 723 627 615 142 739 761 7 653 209 1021 400 14 655 600 347 954 694 394 55...
output:
95590
result:
ok "95590"
Test #50:
score: 20
Accepted
time: 16ms
memory: 7672kb
input:
200000 0 629 413 500 592 649 1 867 473 342 620 330 785 772 562 524 777 146 497 192 603 362 267 122 554 328 183 572 786 794 142 822 908 168 432 858 504 64 628 319 893 628 211 57 709 384 597 193 316 66 699 79 418 458 999 477 288 138 133 254 213 1005 930 79 273 771 572 400 995 395 348 217 88 959 743 50...
output:
96057
result:
ok "96057"
Test #51:
score: 20
Accepted
time: 18ms
memory: 8316kb
input:
200000 0 1477 526 106 494 1384 558 275 1285 209 1640 1182 685 679 828 209 1783 1560 1884 1316 421 702 682 1918 896 260 1410 888 513 983 581 393 1803 1358 237 840 26 1523 21 1358 522 272 1613 804 336 1919 10 65 326 1451 558 1267 1643 1008 1802 509 31 1008 1574 651 1155 599 92 360 1857 1942 1935 1347 ...
output:
94244
result:
ok "94244"
Test #52:
score: 20
Accepted
time: 18ms
memory: 7404kb
input:
200000 0 1972 147 127 1715 994 210 685 994 1863 61 65 1196 1496 840 1675 1323 1552 1721 348 41 1646 1128 397 1666 975 623 518 1011 1235 1197 1210 1441 1613 860 712 1702 656 878 452 973 846 648 1033 730 91 1892 26 1051 1143 1600 1978 1108 1057 1962 1134 84 965 167 1554 1141 1048 721 1638 1343 6 1787 ...
output:
94161
result:
ok "94161"
Test #53:
score: 20
Accepted
time: 20ms
memory: 7296kb
input:
200000 0 1341 3309 846 1742 2279 501 870 3994 900 359 1640 899 1137 1514 2428 933 2132 1202 3324 2831 2359 2774 1776 589 1472 2620 2121 1852 3332 757 1899 3476 3817 528 1403 3473 3234 1128 79 3366 270 2322 3162 2354 1936 2082 2061 787 1127 798 837 463 235 4009 3391 2454 2757 2387 64 299 1117 1521 39...
output:
92483
result:
ok "92483"
Test #54:
score: 20
Accepted
time: 21ms
memory: 7656kb
input:
200000 0 524 1074 2931 859 4003 903 1408 3112 2455 3158 763 3145 1321 862 2824 603 3491 1934 212 2171 2524 2533 975 1290 274 2166 2457 2726 1348 4041 10 2208 2507 2793 3797 3157 3132 3315 1289 989 108 212 1564 648 61 3207 2816 2478 1133 3178 3303 673 2571 1055 3739 2320 2352 4094 3476 4043 2551 9 29...
output:
92515
result:
ok "92515"
Test #55:
score: 20
Accepted
time: 23ms
memory: 8700kb
input:
200000 0 545 3440 3256 3758 169 3124 2814 4446 3673 5414 475 5479 3246 2916 3951 4150 2321 2017 2945 2278 5856 3340 455 7121 1836 1876 1778 5051 3282 8108 4203 1450 4688 2434 8127 2303 2310 2303 3639 1484 26 7206 7214 2498 590 4579 5272 2407 1778 2178 3582 6928 1422 5358 7241 7561 6296 5747 1532 414...
output:
90478
result:
ok "90478"
Test #56:
score: 20
Accepted
time: 23ms
memory: 7808kb
input:
200000 0 6555 2777 2744 7295 2924 6368 1886 1851 2093 5717 4801 5701 3270 2251 5794 6999 5703 5578 6020 4169 4239 4308 4068 5224 4947 1069 4747 7042 7795 3072 6182 7255 7319 3156 1722 7259 4459 4209 6242 2297 3466 5187 266 1167 7259 5306 1933 740 4523 7351 4140 3236 319 7455 5441 5910 2421 3385 3049...
output:
90139
result:
ok "90139"
Test #57:
score: 20
Accepted
time: 22ms
memory: 8824kb
input:
200000 0 8063 263 211 10655 6078 16190 11348 15618 15841 15503 5228 15536 1674 184 10629 3793 8682 3529 10848 1082 7710 15012 11017 7292 10042 7252 6827 1388 11919 5302 15713 2175 311 11563 10017 2292 5914 13507 1758 2342 15046 11356 12337 7545 913 13694 7374 13226 3085 10510 10329 10155 13450 12212...
output:
88332
result:
ok "88332"
Test #58:
score: 20
Accepted
time: 24ms
memory: 8424kb
input:
200000 0 13676 14198 4693 26 9041 13446 1372 13510 10505 10043 6790 4772 2349 6519 13876 14237 5677 8286 12193 1912 926 8000 5417 11187 5042 9760 11205 6126 3216 2135 6306 1476 4694 8236 12713 1207 10323 870 9751 14673 6411 2064 3558 8546 3876 13806 7748 1410 12978 14692 9117 6835 8228 14796 3467 19...
output:
88288
result:
ok "88288"
Test #59:
score: 20
Accepted
time: 24ms
memory: 8704kb
input:
200000 0 11707 279 29710 31692 7327 27020 27139 26667 14285 10895 2965 29687 32472 30371 16878 3950 16110 11936 3228 9071 1938 3785 29761 28253 15272 23413 20810 30353 27762 18758 12319 26764 14537 21575 26159 11228 19728 9233 10574 18689 25272 12290 24921 23837 30846 13492 26143 13558 32711 5386 45...
output:
87066
result:
ok "87066"
Test #60:
score: 20
Accepted
time: 28ms
memory: 9464kb
input:
200000 0 27565 17854 31918 27205 20203 25256 15105 14527 13413 22977 8391 15770 25761 24288 20546 12881 19836 23937 15369 8830 21571 7779 802 18843 14742 4989 14113 22588 6888 23713 15581 28362 24083 15056 10222 21968 30609 364 29418 1745 18131 17998 12522 22441 15536 28816 25141 23127 25364 17780 3...
output:
87022
result:
ok "87022"
Subtask #4:
score: 0
Time Limit Exceeded
Test #61:
score: 0
Time Limit Exceeded
input:
200000 200000 1 2 1 2 2 1 2 1 2 1 1 2 1 1 2 1 1 2 1 2 2 1 2 2 2 1 2 2 2 2 2 1 2 1 2 1 1 2 1 1 2 2 2 1 1 2 2 1 2 1 2 1 1 2 1 2 2 2 1 2 1 2 1 1 1 1 2 1 1 1 1 1 1 1 2 2 2 2 2 2 2 1 1 2 2 1 2 2 2 2 2 1 1 1 2 2 2 1 1 1 1 1 1 1 2 2 1 2 2 1 1 1 1 1 2 2 2 2 2 2 1 1 2 2 2 1 2 2 2 2 1 1 1 2 2 1 2 2 2 1 1 1 2 ...
output:
99575 99575 99575 99575 99574 99573 99573 99574 99575 99575 99575 99575 99576 99575 99575 99574 99574 99574 99575 99576 99576 99575 99574 99573 99574 99575 99575 99576 99575 99574 99573 99573 99573 99572 99572 99571 99572 99571 99571 99571 99572 99572 99571 99572 99572 99572 99572 99572 99571 99571 ...
result:
Subtask #5:
score: 0
Time Limit Exceeded
Test #71:
score: 0
Time Limit Exceeded
input:
100000 100000 2 1 1 1 1 1 1 2 2 2 2 1 2 1 1 1 2 2 1 2 1 2 2 2 2 2 2 2 1 2 2 2 1 1 1 1 1 2 2 2 2 1 1 2 2 2 1 2 2 1 2 1 2 2 2 2 1 2 1 1 1 2 2 2 1 1 2 1 1 1 2 1 2 2 2 1 1 2 1 1 2 1 1 1 1 1 1 1 2 2 1 1 2 1 2 1 2 1 2 2 2 2 2 2 2 1 1 1 1 2 1 2 1 1 1 1 2 2 2 1 2 1 1 1 2 2 2 1 1 2 1 2 2 2 2 2 1 1 2 1 1 1 1 ...
output:
49860 49859 49859 49859 49858 49858 49858 49859 49858 49858 49857 49858 49858 49857 49856 49855 49854 49854 49854 49854 49854 49854 49854 49854 49853 49853 49854 49854 49855 49855 49854 49854 49853 49852 49852 49852 49852 49851 49851 49852 49852 49851 49850 49849 49849 49849 49849 49848 49848 49848 ...
result:
Subtask #6:
score: 0
Time Limit Exceeded
Test #101:
score: 0
Time Limit Exceeded
input:
200000 200000 1 2 1 1 2 1 1 1 2 1 2 2 2 1 2 1 1 2 2 2 1 2 2 2 2 1 2 1 1 1 1 2 1 2 2 1 2 2 2 2 1 1 1 2 1 1 1 2 2 1 1 1 2 1 1 2 1 1 2 2 1 1 2 2 2 1 1 1 1 1 1 2 1 1 2 1 2 2 1 2 2 2 1 2 2 1 2 2 1 1 1 1 1 2 2 2 1 1 2 2 1 1 1 2 2 1 1 2 2 2 2 2 2 1 2 1 1 2 2 2 1 1 1 2 1 2 1 1 1 1 1 2 1 1 2 2 1 1 2 2 1 2 1 ...
output:
99491 99491 99492 99493 99494 99493 99493 99493 99493 99493 99494 99494 99495 99495 99495 99494 99494 99493 99494 99494 99495 99495 99495 99494 99494 99494 99493 99492 99492 99492 99492 99492 99493 99493 99493 99492 99491 99491 99492 99491 99492 99492 99491 99491 99492 99492 99491 99490 99490 99490 ...