QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#790236 | #9641. Two permutations | wsyear | 100 ✓ | 293ms | 10740kb | C++20 | 2.2kb | 2024-11-28 08:56:41 | 2024-11-28 08:56:41 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i, j, k) for (int i = (j); i <= (k); ++i)
#define per(i, j, k) for (int i = (j); i >= (k); --i)
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
using ll = long long;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
template<class T>inline void chkmn(T &x, T y) { if (y < x) x = y; }
template<class T>inline void chkmx(T &x, T y) { if (y > x) x = y; }
using namespace std;
const int maxn = 200010;
int n, val[maxn], ty[maxn], ins[maxn];
struct DS {
int pre[maxn], suf[maxn], hd, tl, a[maxn];
void init() {
rep (i, 1, n) pre[i] = suf[i] = 0;
hd = tl = 1;
}
void addback(int x) {
suf[tl] = x, pre[x] = tl, tl = x;
}
void addfront(int x) {
pre[hd] = x, suf[x] = hd, hd = x;
}
void addafter(int x, int v) {
if (x == tl) return addback(v), void();
int y = suf[x];
pre[v] = x, suf[v] = y, suf[x] = pre[y] = v;
}
void addbefore(int x, int v) {
if (x == hd) return addfront(v), void();
int y = pre[x];
pre[v] = y, suf[v] = x, suf[y] = pre[x] = v;
}
void dao() {
int x = hd;
rep (i, 1, n) a[i] = x, x = suf[x];
}
} A, B;
void work() {
cin >> n;
rep (i, 1, n) cin >> val[i];
rep (i, 1, n) if (val[i] > i) return cout << "No\n", void();
ty[1] = ins[1] = 0, A.init(), B.init(), A.addback(1), B.addback(1);
rep (i, 2, n) {
if (val[i] == i) {
A.addfront(i), B.addback(i), ty[i] = 1, ins[i] = 1;
} else if (ty[val[i]] == 0) {
if (ins[val[i]] == 0) {
A.addafter(val[i], i), B.addback(i), ty[i] = 1, ins[i] = 1;
} else {
B.addafter(val[i], i), A.addback(i), ty[i] = 1, ins[i] = 0;
}
} else {
if (ins[val[i]] == 0) {
A.addbefore(val[i], i), B.addfront(i), ty[i] = 0, ins[i] = 1;
} else {
B.addbefore(val[i], i), A.addfront(i), ty[i] = 0, ins[i] = 0;
}
}
}
A.dao(), B.dao();
cout << "Yes\n";
per (i, n, 1) cout << A.a[i] << " ";
rep (i, 1, n) cout << B.a[i] << " \n"[i == n];
}
int main() {
cin.tie(nullptr) -> ios::sync_with_stdio(false);
int t; cin >> t;
while (t--) work();
}
详细
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 1ms
memory: 7756kb
input:
10 1 1 2 1 1 3 1 2 2 4 1 1 3 2 5 1 2 1 2 1 2 1 1 1 1 3 1 2 2 1 1 5 1 1 1 3 2
output:
Yes 1 1 Yes 2 1 1 2 Yes 1 2 3 1 3 2 Yes 2 1 3 4 1 4 2 3 Yes 3 5 1 2 4 1 4 2 3 5 Yes 2 1 1 2 Yes 1 1 Yes 1 2 3 1 3 2 Yes 1 1 Yes 2 3 1 4 5 1 5 2 4 3
result:
ok Correct!
Test #2:
score: 10
Accepted
time: 1ms
memory: 9852kb
input:
10 4 1 2 3 3 1 1 5 1 2 1 4 2 1 1 3 1 1 1 5 1 1 1 1 1 3 1 2 1 5 1 1 2 3 4 5 1 1 1 3 2 5 1 1 3 1 5
output:
Yes 1 2 3 4 1 2 4 3 Yes 1 1 Yes 3 1 2 4 5 1 5 2 3 4 Yes 1 1 Yes 2 3 1 1 2 3 Yes 2 3 4 5 1 1 2 3 4 5 Yes 3 1 2 1 2 3 Yes 2 1 4 3 5 1 3 2 5 4 Yes 2 3 1 4 5 1 5 2 4 3 Yes 2 4 1 3 5 1 2 3 4 5
result:
ok Correct!
Test #3:
score: 10
Accepted
time: 1ms
memory: 9848kb
input:
10 5 1 2 3 4 5 5 1 1 2 3 4 5 1 2 2 3 4 5 1 1 3 2 5 5 1 1 1 1 1 5 1 2 3 4 4 5 1 2 2 2 2 5 1 1 1 2 3 5 1 2 1 2 1 5 1 2 1 2 2
output:
Yes 1 2 3 4 5 1 2 3 4 5 Yes 2 1 4 3 5 1 3 2 5 4 Yes 1 2 4 3 5 1 3 2 5 4 Yes 2 1 3 4 5 1 4 2 3 5 Yes 2 3 4 5 1 1 2 3 4 5 Yes 1 2 3 4 5 1 2 3 5 4 Yes 1 2 3 4 5 1 3 4 5 2 Yes 2 3 1 4 5 1 4 2 5 3 Yes 3 5 1 2 4 1 4 2 3 5 Yes 3 1 2 4 5 1 4 5 2 3
result:
ok Correct!
Subtask #2:
score: 10
Accepted
Test #4:
score: 10
Accepted
time: 1ms
memory: 9792kb
input:
10 10 1 2 3 4 3 1 2 4 3 8 10 1 2 1 1 4 6 4 5 2 9 10 1 2 2 4 5 3 7 7 2 3 10 1 1 2 4 5 4 3 5 7 7 10 1 2 2 4 4 1 6 6 6 10 10 1 2 2 4 1 3 7 7 1 10 10 1 2 3 4 2 1 3 3 1 7 10 1 1 1 4 5 1 3 5 4 7 10 1 2 2 1 1 2 6 5 8 5 10 1 2 2 2 5 3 6 2 4 5
output:
Yes 6 1 2 3 4 5 7 10 8 9 1 7 2 5 9 3 8 4 6 10 Yes 3 4 1 2 8 5 6 7 10 9 1 9 2 3 5 7 4 6 8 10 Yes 1 2 6 10 3 4 5 7 8 9 1 3 9 2 4 5 6 8 7 10 Yes 2 1 7 3 4 5 6 8 9 10 1 3 2 6 4 8 5 9 10 7 Yes 6 1 2 3 4 5 7 8 9 10 1 3 2 5 4 7 8 9 6 10 Yes 5 9 1 2 6 3 4 7 8 10 1 3 2 4 5 6 8 7 9 10 Yes 6 9 1 2 3 4 5 10 7 8...
result:
ok Correct!
Test #5:
score: 10
Accepted
time: 1ms
memory: 7768kb
input:
10 10 1 1 3 1 1 1 2 3 5 7 10 1 2 2 1 4 5 6 7 9 8 10 1 2 2 1 5 4 2 3 6 8 10 1 1 1 4 5 3 1 2 2 3 10 1 1 2 4 5 2 6 2 6 3 10 1 2 3 3 5 4 6 1 9 6 10 1 1 1 4 1 4 1 2 8 10 10 1 2 2 2 1 3 1 1 5 8 10 1 1 3 1 5 3 2 5 6 5 10 1 2 3 4 1 5 7 8 4 2
output:
Yes 2 4 5 6 1 3 10 7 8 9 1 7 2 8 3 4 9 5 6 10 Yes 4 1 2 3 6 5 8 7 9 10 1 3 2 5 4 7 6 10 8 9 Yes 4 1 2 8 3 5 9 6 7 10 1 3 7 2 6 4 5 10 8 9 Yes 2 3 7 1 4 5 6 8 9 10 1 8 9 2 6 10 3 4 5 7 Yes 2 1 10 3 4 5 7 9 6 8 1 3 6 8 2 4 5 7 9 10 Yes 8 1 2 3 6 4 5 7 9 10 1 2 4 3 5 7 10 6 8 9 Yes 2 3 5 7 1 4 6 9 8 10...
result:
ok Correct!
Test #6:
score: 10
Accepted
time: 1ms
memory: 9752kb
input:
10 10 1 1 1 3 5 4 1 2 8 9 10 1 2 2 1 2 2 5 4 5 1 10 1 1 1 1 1 2 5 2 1 10 10 1 2 2 3 2 1 3 4 7 4 9 1 1 4 3 3 5 5 4 5 9 1 1 2 2 5 4 6 3 3 9 1 2 1 4 3 5 2 5 3 10 1 2 2 4 2 5 5 3 1 9 9 1 2 3 2 4 5 6 8 9 10 1 1 1 1 4 6 4 5 7 10
output:
Yes 2 3 7 1 6 4 5 9 8 10 1 8 2 4 3 5 6 7 10 9 Yes 4 10 1 2 3 7 9 5 6 8 1 3 5 6 2 8 4 7 9 10 Yes 2 3 4 5 9 1 6 7 8 10 1 6 8 2 3 4 7 5 9 10 Yes 6 1 2 4 7 3 5 8 9 10 1 3 5 2 8 10 4 6 9 7 No Yes 2 1 8 9 3 6 4 5 7 1 3 4 2 5 7 6 8 9 Yes 3 1 2 4 6 8 5 7 9 1 7 2 5 9 3 4 6 8 Yes 9 1 2 8 3 4 6 7 5 10 1 3 5 2 ...
result:
ok Correct!
Subtask #3:
score: 15
Accepted
Test #7:
score: 15
Accepted
time: 84ms
memory: 10580kb
input:
10 177329 1 1 2 2 1 4 1 2 3 3 2 3 4 1 2 3 3 2 2 2 2 3 4 3 1 2 4 2 4 1 4 2 2 4 1 3 3 4 1 1 1 3 2 4 3 3 2 4 2 2 4 1 1 4 3 1 4 4 4 3 1 4 1 3 2 1 2 3 2 4 2 4 4 2 1 3 2 2 2 3 3 1 4 1 3 1 2 4 1 4 2 3 4 3 1 4 4 1 2 2 3 3 4 1 4 4 3 4 3 2 1 2 4 3 1 1 4 4 4 2 3 4 3 3 3 1 4 4 1 1 2 4 4 1 3 4 4 4 2 1 2 2 1 2 3 ...
output:
Yes 2 5 7 14 25 30 35 39 40 41 52 53 56 61 63 66 75 82 84 86 89 95 98 104 111 115 116 126 129 130 134 140 143 151 152 154 155 166 173 174 175 179 180 182 190 192 206 207 209 214 221 224 226 235 239 242 243 246 252 256 259 261 274 277 278 288 289 291 292 294 295 297 300 305 307 310 312 314 320 321 32...
result:
ok Correct!
Test #8:
score: 15
Accepted
time: 113ms
memory: 10636kb
input:
10 42861 1 2 1 2 3 1 2 2 1 1 3 4 3 1 2 3 2 2 3 2 3 4 2 2 2 4 2 3 1 2 1 4 4 2 4 3 1 1 4 3 1 1 4 1 1 4 3 3 1 3 3 3 2 4 4 1 3 2 1 1 1 1 1 1 4 3 1 1 2 4 1 1 2 4 2 3 4 4 4 2 4 3 3 3 2 1 3 4 4 3 1 3 4 4 4 1 4 4 1 3 2 4 4 3 3 4 3 3 4 3 1 4 2 1 2 3 2 4 3 4 1 2 3 4 2 4 1 3 4 1 1 1 4 3 4 2 1 4 3 1 3 3 2 1 1 4...
output:
Yes 3 6 9 10 14 29 31 37 38 41 42 44 45 49 56 59 60 61 62 63 64 67 68 71 72 86 91 96 99 111 114 121 127 130 131 132 137 140 144 145 152 158 160 174 178 184 186 189 192 196 199 212 228 230 233 235 243 247 248 249 250 255 260 270 271 274 282 287 289 296 298 306 309 311 313 315 317 318 319 323 326 338 ...
result:
ok Correct!
Test #9:
score: 15
Accepted
time: 78ms
memory: 10420kb
input:
10 45364 1 1 1 1 1 1 1 2 2 2 2 1 2 4 3 3 1 4 1 3 2 2 3 1 2 2 3 2 3 3 3 2 3 3 2 3 2 1 1 3 4 2 2 4 4 3 1 2 4 1 3 4 4 1 3 4 1 4 3 2 1 2 3 3 4 4 1 3 3 3 2 3 4 4 2 1 2 1 2 1 1 2 2 2 3 1 3 3 1 4 1 3 1 2 3 4 2 2 3 3 1 3 3 4 4 4 4 1 1 4 4 1 4 2 2 1 1 4 3 3 4 3 4 4 4 4 4 1 4 4 1 4 3 1 3 1 3 3 4 1 1 2 1 2 1 3...
output:
Yes 2 3 4 5 6 7 12 17 19 24 38 39 47 50 54 57 61 67 76 78 80 81 86 89 91 93 101 108 109 112 116 117 128 131 134 136 140 141 143 145 154 155 156 159 163 177 178 180 183 198 205 208 210 213 218 220 224 225 226 235 242 245 261 267 274 276 277 278 279 284 285 286 289 303 307 313 317 322 327 331 335 338 ...
result:
ok Correct!
Test #10:
score: 15
Accepted
time: 80ms
memory: 10452kb
input:
10 60502 1 1 3 2 4 3 2 4 4 1 2 2 3 3 4 3 3 4 3 1 3 4 1 2 1 1 2 1 4 2 2 2 4 4 4 3 3 1 4 1 3 4 4 4 4 2 1 3 1 2 4 4 2 1 4 4 1 2 3 3 1 2 2 4 1 3 3 1 4 1 2 2 4 1 1 4 2 1 3 3 4 4 4 4 2 2 2 2 4 4 4 3 4 3 2 4 4 4 1 4 2 3 2 3 2 3 2 1 3 2 4 2 1 1 1 3 2 3 2 2 1 2 1 4 2 2 4 4 2 3 2 4 2 1 4 2 3 2 1 1 1 1 3 2 2 3...
output:
Yes 2 10 20 23 25 26 28 38 40 47 49 54 57 61 65 68 70 74 75 78 99 108 113 114 115 121 123 134 139 140 141 142 159 165 168 173 174 179 180 182 183 189 195 202 206 207 208 216 219 222 223 227 232 233 235 237 238 239 245 246 250 251 254 267 271 275 277 280 288 289 291 293 299 301 302 308 311 313 320 32...
result:
ok Correct!
Test #11:
score: 15
Accepted
time: 110ms
memory: 10664kb
input:
10 192651 1 2 4 1 3 2 3 1 1 4 2 2 2 2 1 3 2 3 1 1 1 1 2 4 3 4 2 2 1 2 3 4 4 3 1 3 1 4 1 3 4 1 4 2 4 1 2 1 2 2 4 2 4 4 1 4 3 2 2 1 1 3 1 3 2 2 3 1 4 3 4 4 3 1 3 2 2 2 3 3 3 1 1 2 3 3 2 3 2 3 3 4 2 4 1 1 2 1 4 4 1 1 1 1 1 2 2 2 2 4 3 3 4 4 2 3 2 1 2 3 2 2 1 4 3 4 1 4 2 4 4 4 2 1 1 3 2 1 2 1 3 1 2 3 1 ...
output:
No Yes 2 3 17 20 21 22 27 28 36 45 51 62 71 78 82 84 85 86 87 95 96 98 101 108 109 115 119 120 126 131 133 138 142 143 145 148 154 164 171 181 188 194 200 206 216 218 228 238 241 242 252 254 262 279 284 285 287 290 292 301 313 315 319 327 329 330 333 335 343 346 349 352 358 364 365 369 373 374 379 3...
result:
ok Correct!
Test #12:
score: 15
Accepted
time: 74ms
memory: 10576kb
input:
10 96064 1 1 1 1 4 4 1 4 1 1 2 1 3 4 3 2 2 2 1 1 1 2 1 1 3 4 1 2 2 3 2 2 3 4 4 3 3 3 4 3 2 3 3 4 3 4 3 4 2 3 2 2 3 4 1 1 1 2 3 2 3 3 4 1 4 4 3 1 2 3 3 3 3 2 4 4 2 2 3 4 4 1 4 1 1 2 1 4 2 3 3 2 4 2 1 4 3 4 1 4 4 2 1 3 1 2 4 2 2 4 3 3 4 4 4 3 3 4 1 3 2 1 2 1 2 1 2 1 2 4 3 4 1 4 4 4 2 1 2 1 4 3 3 4 2 1...
output:
Yes 2 3 4 7 9 10 12 19 20 21 23 24 27 55 56 57 64 68 82 84 85 87 95 99 103 105 119 122 124 126 128 133 138 140 146 150 154 159 163 166 174 175 176 177 179 184 185 186 203 212 216 217 224 226 249 261 264 265 267 283 286 288 294 295 302 308 309 313 328 333 336 344 365 373 377 378 384 387 390 397 409 4...
result:
ok Correct!
Subtask #4:
score: 15
Accepted
Test #13:
score: 15
Accepted
time: 248ms
memory: 10676kb
input:
10 199850 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10...
output:
Yes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
result:
ok Correct!
Test #14:
score: 15
Accepted
time: 258ms
memory: 10740kb
input:
10 199997 1 1 1 4 4 6 4 8 4 10 11 10 6 14 15 16 17 15 19 15 14 4 15 10 25 26 27 1 29 30 31 26 33 15 30 36 37 38 39 38 33 4 10 44 25 33 33 11 49 50 31 1 53 54 55 14 50 58 8 49 36 6 63 39 65 6 33 10 69 29 19 72 29 74 1 76 63 49 4 80 50 82 83 15 4 86 87 50 89 36 27 89 93 11 95 63 1 37 99 100 101 102 10...
output:
Yes 2 3 28 52 75 97 1928 5175 12332 20407 47532 1 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 9...
result:
ok Correct!
Test #15:
score: 15
Accepted
time: 252ms
memory: 10680kb
input:
10 199730 1 2 2 2 1 2 2 1 2 10 2 12 13 10 15 16 17 13 19 20 1 13 16 24 19 2 27 28 29 17 28 12 1 16 28 1 17 13 24 17 41 42 24 17 41 28 47 2 2 2 51 52 51 15 42 56 57 42 59 20 51 62 47 64 47 66 42 12 69 70 69 15 51 74 10 47 77 78 13 69 81 82 83 84 64 2 87 28 10 90 91 10 13 74 70 96 97 12 99 17 15 17 87...
output:
Yes 5 8 21 33 36 107 206 230 233 239 257 338 908 982 1546 4261 5880 6829 13759 14036 18578 24293 29360 102979 119054 1 2 3 4 6 7 9 10 11 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 34 35 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 6...
result:
ok Correct!
Test #16:
score: 15
Accepted
time: 258ms
memory: 10596kb
input:
10 199782 1 2 2 2 1 1 1 1 1 2 2 2 2 2 2 2 1 1 1 1 2 2 1 2 1 1 2 1 1 2 2 1 33 33 33 33 1 2 1 1 2 2 1 2 2 33 2 1 1 1 33 33 2 33 2 1 2 2 1 1 2 1 1 33 2 2 1 33 2 1 33 1 1 2 2 33 2 33 2 1 33 33 33 2 2 1 1 1 1 1 33 2 2 2 2 33 1 1 2 33 1 33 1 1 1 2 2 2 33 33 33 2 2 1 33 2 33 2 2 2 33 33 1 1 33 1 33 2 1 2 3...
output:
Yes 5 6 7 8 9 17 18 19 20 23 25 26 28 29 32 37 39 40 43 48 49 50 56 59 60 62 63 67 70 72 73 80 86 87 88 89 90 97 98 101 103 104 105 114 123 124 126 129 136 137 138 139 140 141 142 148 150 151 153 155 156 160 166 172 177 178 180 184 192 193 196 197 201 202 203 206 219 220 224 226 227 230 233 237 241 ...
result:
ok Correct!
Test #17:
score: 15
Accepted
time: 220ms
memory: 10692kb
input:
10 199768 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
Yes 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...
result:
ok Correct!
Test #18:
score: 15
Accepted
time: 89ms
memory: 6232kb
input:
10 199897 1 133473 137888 154846 104937 137888 3569 104774 144338 186307 16043 175982 174471 97731 56127 91564 38890 40649 89585 22112 91564 169703 102594 111754 96581 132350 39595 142435 3652 102405 58841 71649 89585 104964 111754 27732 141427 45005 177850 292 102734 71015 113628 177036 16043 30227...
output:
No No No No No No No No No No
result:
ok Correct!
Subtask #5:
score: 50
Accepted
Test #19:
score: 50
Accepted
time: 271ms
memory: 10684kb
input:
10 199755 1 2 1 3 5 1 6 7 2 1 5 6 10 9 12 2 4 14 2 18 5 17 23 4 6 7 4 6 20 27 16 24 29 8 33 26 33 27 17 39 5 33 34 41 4 16 24 19 42 8 29 48 48 27 37 24 43 13 4 28 38 27 38 23 29 55 14 62 26 9 62 20 35 31 57 74 69 5 26 60 33 59 5 19 21 45 15 87 3 54 17 2 57 36 18 67 25 62 47 53 89 27 5 59 75 77 29 9 ...
output:
Yes 3 6 10 1026 1098 1218 2009 3029 4012 5130 5454 5960 9031 9337 24561 1 2 17 24 27 45 59 128 204 257 880 2341 3982 6662 11456 86684 90332 108289 117426 4 5 8 26 609 829 1590 3328 7115 8457 16916 22458 66923 7 14 70 108 260 18908 22540 197288 9 7391 9787 45366 11 15 133 199 5110 7564 81496 12 58 11...
result:
ok Correct!
Test #20:
score: 50
Accepted
time: 293ms
memory: 10740kb
input:
10 199738 1 1 2 1 5 4 6 6 2 8 7 1 5 13 11 9 7 13 3 8 7 14 8 24 17 12 1 11 20 28 4 20 17 12 6 15 32 36 19 11 25 37 26 43 4 37 22 5 18 10 46 51 41 20 23 52 7 28 49 49 27 62 25 7 17 55 59 27 19 1 32 51 9 54 4 24 13 26 7 78 11 40 30 63 31 8 71 61 24 26 57 35 36 76 49 4 89 51 48 100 72 100 58 3 59 66 36 ...
output:
Yes 2 4 12 27 70 551 9851 37890 52193 136333 174707 1 19 104 111 186 889 4957 45191 69145 3 5 7 8 35 478 643 2885 3327 8882 16715 29086 67517 160194 173385 6 16 73 728 2738 69842 84864 9 50 116 120 227 303 589 716 2313 2432 5783 17547 55843 137390 10 15 28 40 81 166 182 256 379 732 1479 2310 3774 64...
result:
ok Correct!
Test #21:
score: 50
Accepted
time: 292ms
memory: 10680kb
input:
10 199701 1 1 3 2 5 6 6 1 1 5 7 10 13 12 1 12 5 16 10 19 16 6 21 20 21 17 18 26 8 17 13 18 9 34 32 1 24 10 35 15 26 31 37 42 1 19 22 40 32 3 16 48 19 11 47 17 31 24 27 54 20 7 55 9 24 4 24 25 21 12 65 62 38 11 50 13 43 69 53 54 78 61 80 19 6 9 55 77 60 26 42 19 16 60 32 94 25 39 29 57 4 93 56 56 86 ...
output:
Yes 2 8 9 15 36 45 160 1063 1567 2845 9753 29371 68203 195515 1 3 66 101 155 280 292 295 477 851 1172 4110 13766 74761 142292 4 5 6 11 62 500 990 1912 2322 12723 26754 32964 7 12 19 38 574 2309 8245 18379 10 13 460 545 604 992 54894 14 18 21 51 93 118 2758 4331 7154 7405 39394 54984 110318 16 26 30 ...
result:
ok Correct!
Test #22:
score: 50
Accepted
time: 247ms
memory: 10616kb
input:
10 199753 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10...
output:
Yes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
result:
ok Correct!
Test #23:
score: 50
Accepted
time: 250ms
memory: 10680kb
input:
10 199750 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...
output:
Yes 2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 102 ...
result:
ok Correct!
Test #24:
score: 50
Accepted
time: 265ms
memory: 10620kb
input:
10 200000 1 2 2 2 5 3 6 2 9 1 9 5 6 1 15 12 9 15 9 19 7 14 16 23 7 16 6 14 17 20 24 8 32 6 14 11 15 30 4 38 17 37 24 11 27 2 27 17 19 32 36 25 31 26 35 1 10 31 46 17 4 39 28 3 49 22 24 47 33 4 28 26 20 74 67 73 57 33 23 62 73 14 16 67 37 83 8 4 51 2 2 81 88 27 28 11 49 45 25 31 37 77 83 99 8 44 63 3...
output:
Yes 10 14 56 279 1335 2651 10218 12047 1 2 6 64 396 3487 4999 8177 31044 81115 143734 3 39 61 70 88 159 839 2172 9567 21112 32886 110967 120113 4 5 21 25 128 455 502 1607 5006 7883 8639 16541 59320 94450 101292 120837 129956 7 32 87 105 150 845 1514 1933 5549 12812 15729 21718 36395 8 9 36 44 96 322...
result:
ok Correct!
Test #25:
score: 50
Accepted
time: 276ms
memory: 10740kb
input:
10 199804 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 4 3 6 2 5 1 5 6 2 7 1 12 12 14 16 16 3 10 7 16 5 25 17 20 5 13 15 6 7 7 21 9 18 26 8 26 6 22 34 25 24 21 9 16 3 13 48 42 41 50 43 26 17 12 53 57 43 56 60 63 42 29 63 20 40 7 6 65 66 64 36 25 72 49 14 27 37 32 59 61 9 85 31 70 21 2 54 12 50 31 7...
output:
Yes 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 29 34 223 294 344 1600 1744 2311 7693 117051 1 61 277 570 1380 1936 3415 13260 99743 173414 22 310 448 10072 23 64 305 1103 10407 21763 139395 183805 24 45 63 95 148 427 1532 9949 58029 25 57 59 75 189 335 339 375 437 932 20341 38005 133120 26 ...
result:
ok Correct!
Test #26:
score: 50
Accepted
time: 283ms
memory: 10612kb
input:
10 199826 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 2 3 6 5 4 1 10 9 7 7 3 6 4 5 7 10 6 7 5 6 3 20 22 11 11 27 27 21 17 5 32 17 26 10 4 29 29 11 24 14 27 32 11 43 36 21 22 13 28 43 33 17 51 7 15 30 37 38 8 28 61 4 38 65 65 4 23 22 35 4 8 1 43 75 39 12 38 73 50 42 71 80 82 69 88 9 44 84 12 49 83 ...
output:
Yes 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 29 95 130 985 1471 1572 2619 5320 13176 39868 69178 98755 110288 1 46 70 91 199 241 760 1376 3251 4724 5131 16409 80518 22 90 154 240 844 5997 37708 174259 23 62 506 12628 116614 24 196 447 469 563 940 2339 4421 6867 8387 10247 14654 14862 2165...
result:
ok Correct!
Test #27:
score: 50
Accepted
time: 283ms
memory: 10740kb
input:
10 199955 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 4 1 6 7 1 8 8 1 7 12 10 8 9 13 5 3 19 18 8 15 24 5 5 14 23 13 14 6 29 28 12 13 3 7...
output:
Yes 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...
result:
ok Correct!
Test #28:
score: 50
Accepted
time: 267ms
memory: 10740kb
input:
10 199833 1 1 1 1 9 5 4 7 2 6 7 2 12 2 4 7 6 4 6 19 18 2 8 6 18 22 21 7 25 18 22 24 24 29 1 3 10 18 28 26 33 3 25 42 17 37 31 14 26 39 18 25 35 6 21 4 5 37 34 56 25 7 26 25 17 22 31 42 54 6 17 35 13 34 15 1 35 37 43 19 50 70 59 70 34 45 63 37 29 4 82 52 35 8 4 10 45 33 40 40 58 23 73 74 86 3 54 55 4...
output:
No Yes 3 4 19 89 1463 2335 6189 6205 13362 24335 25858 29180 38542 56605 58398 1 2 21 64 81 90 285 547 18314 47698 142849 5 8 29 34 115 233 748 1461 8797 6 121 1709 5808 11227 30228 40240 44839 54803 105388 133678 7 17 87 137 156 346 1484 6082 7636 14404 57872 95472 197847 9 88 118 187 197 982 6447 ...
result:
ok Correct!