QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#219008 | #6550. Elimination Race | hos_lyric | TL | 378ms | 8528kb | C++14 | 4.9kb | 2023-10-18 21:58:26 | 2023-10-18 21:58:26 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")
namespace bm {
constexpr int LIM_N0 = 510;
constexpr int LIM_N1 = 510;
constexpr int LIM_M = 250'010;
int n0, n1, m, as[LIM_M], bs[LIM_M];
int to[LIM_N0], fr[LIM_N1], tof;
int pt[LIM_N0 + 2], zu[LIM_M], used[LIM_N0], lev[LIM_N0], que[LIM_N0], *qb, *qe;
void init(int n0_, int n1_) {
n0 = n0_; n1 = n1_; m = 0;
}
int ae(int u, int v) {
as[m] = u; bs[m] = v; return m++;
}
int augment(int u) {
used[u] = tof;
for (int j = pt[u]; j < pt[u + 1]; ++j) {
const int v = zu[j];
const int w = fr[v];
if (!~w || (used[w] != tof && lev[u] < lev[w] && augment(w))) {
to[u] = v; fr[v] = u; return 1;
}
}
return 0;
}
int run() {
memset(pt, 0, (n0 + 2) * sizeof(int));
for (int i = 0; i < m; ++i) ++pt[as[i] + 2];
for (int u = 2; u <= n0; ++u) pt[u + 1] += pt[u];
for (int i = 0; i < m; ++i) zu[pt[as[i] + 1]++] = bs[i];
memset(to, ~0, n0 * sizeof(int));
memset(fr, ~0, n1 * sizeof(int));
memset(used, ~0, n0 * sizeof(int));
for (tof = 0; ; ) {
qb = qe = que; memset(lev, ~0, n0 * sizeof(int));
for (int u = 0; u < n0; ++u) if (!~to[u]) lev[*qe++ = u] = 0;
for (; qb != qe; ) {
const int u = *qb++;
for (int j = pt[u]; j < pt[u + 1]; ++j) {
const int w = fr[zu[j]];
if (~w && !~lev[w]) lev[*qe++ = w] = lev[u] + 1;
}
}
int f = 0;
for (int u = 0; u < n0; ++u) if (!~to[u]) f += augment(u);
if (!f) return tof;
tof += f;
}
}
// s: true, t: false (s: reachable from unmatched left)
// vertex cover: (0: false, 0: true)
// independent set: (0: true, 1: false)
bool side0[LIM_N0], side1[LIM_N1];
void dfs(int u) {
if (!side0[u]) {
side0[u] = true;
for (int j = pt[u]; j < pt[u + 1]; ++j) {
const int v = zu[j];
if (!side1[v]) {
side1[v] = true;
const int w = fr[v];
if (~w) dfs(w);
}
}
}
}
void minCut() {
memset(side0, 0, n0 * sizeof(bool));
memset(side1, 0, n1 * sizeof(bool));
for (int u = 0; u < n0; ++u) if (!~to[u]) dfs(u);
}
} // namespace bm
int N;
int A[510][510];
int B[510][510];
int main() {
for (; ~scanf("%d", &N); ) {
for (int i = 0; i < N - 1; ++i) for (int j = 0; j < N; ++j) {
scanf("%d", &A[i][j]);
--A[i][j];
}
for (int i = 0; i < N - 1; ++i) for (int j = 0; j < N; ++j) {
B[i][A[i][j]] = j;
}
for (int r = 0; r < N; ++r) {
bm::init(N - 1, N);
for (int i = 0; i < N - 1; ++i) {
for (int j = B[i][r] + 1; j < N; ++j) {
bm::ae(i, A[i][j]);
}
}
const int res = bm::run();
if (res == N - 1) {
vector<int> ans;
vector<int> used(N - 1, 0), elimed(N, 0);
vector<int> js(N, N - 1);
int zeit = 0;
vector<int> vis(N, 0);
for (int i = 0; i < N - 1; ++i) {
for (; !used[i]; ) {
int ii = i;
++zeit;
for (; vis[ii] != zeit; ) {
vis[ii] = zeit;
for (; elimed[A[ii][js[ii]]]; --js[ii]) {}
ii = bm::fr[A[ii][js[ii]]];
}
++zeit;
for (; vis[ii] != zeit; ) {
vis[ii] = zeit;
ans.push_back(ii);
used[ii] = elimed[A[ii][js[ii]]] = 1;
ii = bm::fr[A[ii][js[ii]]];
}
}
}
assert((int)ans.size() == N - 1);
puts("Yes");
for (int h = 0; h < N - 1; ++h) {
if (h) printf(" ");
printf("%d", ans[h] + 1);
}
puts("");
} else {
puts("No");
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5752kb
input:
4 1 2 3 4 2 1 3 4 4 3 1 2
output:
Yes 2 1 3 No No No
result:
ok n=4, yes=1, no=3
Test #2:
score: 0
Accepted
time: 0ms
memory: 5816kb
input:
3 2 1 3 2 1 3
output:
No Yes 2 1 No
result:
ok n=3, yes=1, no=2
Test #3:
score: 0
Accepted
time: 1ms
memory: 5808kb
input:
2 1 2
output:
Yes 1 No
result:
ok n=2, yes=1, no=1
Test #4:
score: 0
Accepted
time: 0ms
memory: 7848kb
input:
2 2 1
output:
No Yes 1
result:
ok n=2, yes=1, no=1
Test #5:
score: 0
Accepted
time: 0ms
memory: 7724kb
input:
11 4 3 6 1 11 10 5 7 8 9 2 11 6 5 1 10 3 8 2 7 9 4 5 9 2 11 3 4 1 10 8 6 7 9 11 8 3 5 4 1 6 7 10 2 3 9 7 6 5 10 1 4 11 8 2 8 2 4 1 5 9 3 7 6 10 11 3 8 2 9 1 4 5 10 11 6 7 10 11 4 1 7 5 2 6 8 9 3 10 6 9 3 2 1 4 8 11 7 5 8 11 9 1 4 10 2 5 3 7 6
output:
Yes 5 1 8 10 4 2 9 6 7 3 No No No No No No Yes 5 1 2 6 9 4 10 3 7 8 Yes 1 2 3 6 4 10 5 9 7 8 Yes 4 1 9 2 8 10 7 3 6 5 No
result:
ok n=11, yes=4, no=7
Test #6:
score: 0
Accepted
time: 0ms
memory: 7868kb
input:
11 6 7 8 9 3 4 1 11 5 10 2 7 10 6 3 1 2 5 11 4 9 8 4 3 9 1 10 2 5 7 6 8 11 10 4 2 11 8 1 5 7 9 6 3 11 9 4 6 8 2 1 7 3 5 10 9 10 2 7 4 11 6 1 3 8 5 11 8 4 9 7 1 2 10 5 3 6 5 7 9 10 1 8 4 2 6 11 3 4 2 9 7 10 1 6 8 3 5 11 2 7 6 10 5 11 1 8 4 9 3
output:
Yes 1 7 9 6 4 2 8 10 3 5 No No Yes 10 1 8 6 4 5 9 2 3 7 No No Yes 1 8 5 2 3 10 4 9 7 6 No Yes 10 3 4 8 9 2 1 6 7 5 No No
result:
ok n=11, yes=4, no=7
Test #7:
score: 0
Accepted
time: 1ms
memory: 7808kb
input:
11 3 5 9 7 4 1 8 11 10 2 6 9 7 10 4 8 3 1 6 5 2 11 9 5 11 3 8 7 1 6 2 4 10 8 9 11 1 4 3 10 6 7 2 5 11 3 7 8 5 9 1 2 10 6 4 8 3 10 11 1 4 2 5 6 7 9 5 9 10 2 4 3 7 1 11 6 8 11 8 10 3 5 7 4 1 2 6 9 7 8 1 9 10 5 3 11 2 6 4 2 4 6 9 5 11 7 1 8 10 3
output:
Yes 1 2 7 5 3 10 9 8 4 6 No No No No No Yes 6 8 1 4 9 2 7 5 3 10 No No No No
result:
ok n=11, yes=2, no=9
Test #8:
score: 0
Accepted
time: 1ms
memory: 5820kb
input:
11 3 5 9 2 11 1 4 8 6 10 7 8 3 4 9 1 5 6 2 7 10 11 10 6 4 7 11 9 1 3 5 8 2 9 3 2 7 8 4 5 10 1 11 6 3 4 9 10 1 8 2 7 6 11 5 9 4 7 8 1 11 6 3 5 2 10 5 11 4 10 6 3 2 1 9 8 7 10 11 8 5 2 1 9 7 4 6 3 6 3 8 9 4 11 1 2 10 7 5 8 3 11 10 9 1 6 5 7 2 4
output:
Yes 1 8 3 9 2 4 10 5 6 7 No No No No No No Yes 7 1 2 10 4 5 8 3 6 9 Yes 1 4 8 3 10 6 5 2 9 7 No No
result:
ok n=11, yes=3, no=8
Test #9:
score: 0
Accepted
time: 1ms
memory: 7780kb
input:
11 3 5 7 10 9 6 2 1 11 8 4 3 6 1 7 5 11 4 10 9 8 2 10 4 6 7 11 3 1 2 9 5 8 10 4 1 9 11 5 3 8 6 7 2 11 5 9 1 10 4 8 6 7 2 3 3 2 7 9 11 10 1 5 8 4 6 4 5 11 8 6 7 10 1 2 3 9 2 7 3 11 8 1 9 6 4 10 5 4 8 2 7 5 10 6 1 11 3 9 9 6 3 5 1 10 11 7 8 4 2
output:
Yes 1 5 7 4 3 2 10 6 8 9 No No No No No Yes 4 10 8 2 6 9 5 7 3 1 No No Yes 1 3 2 7 10 9 5 8 4 6 Yes 1 2 3 10 5 9 4 7 8 6
result:
ok n=11, yes=4, no=7
Test #10:
score: 0
Accepted
time: 1ms
memory: 7772kb
input:
11 6 5 11 2 8 9 7 10 1 4 3 11 4 3 6 10 7 9 1 8 5 2 3 2 6 8 5 7 9 1 10 4 11 11 6 9 1 3 10 4 2 7 8 5 5 6 8 7 11 9 1 3 4 2 10 6 5 3 9 2 1 10 11 8 4 7 9 3 4 6 2 1 5 7 8 10 11 11 6 9 8 1 4 3 2 5 10 7 6 4 7 11 3 2 1 5 8 10 9 10 3 8 6 4 1 11 7 9 2 5
output:
No No No Yes 1 6 5 8 4 9 10 3 7 2 No Yes 1 6 5 2 7 10 3 9 4 8 No Yes 1 5 9 2 7 3 6 4 8 10 No No No
result:
ok n=11, yes=3, no=8
Test #11:
score: 0
Accepted
time: 0ms
memory: 5748kb
input:
11 10 5 4 6 11 1 3 7 9 8 2 2 8 10 4 6 1 7 9 3 11 5 5 7 11 8 3 1 9 2 4 10 6 5 6 11 10 3 1 2 9 8 4 7 6 3 4 9 11 5 1 2 8 10 7 8 7 6 1 10 3 5 11 9 4 2 5 11 9 4 6 2 7 1 8 3 10 10 11 2 1 9 4 3 5 8 6 7 9 3 4 6 5 1 11 8 2 7 10 7 10 4 5 9 6 8 1 3 11 2
output:
Yes 5 3 4 8 7 6 1 2 9 10 No Yes 1 4 2 7 9 8 3 5 6 10 Yes 6 1 7 3 4 10 2 9 5 8 No No No Yes 1 5 4 2 6 8 9 3 7 10 Yes 3 10 1 4 8 7 5 9 2 6 No Yes 10 9 4 8 1 3 7 2 5 6
result:
ok n=11, yes=6, no=5
Test #12:
score: 0
Accepted
time: 1ms
memory: 5752kb
input:
11 7 8 4 5 1 3 6 9 11 10 2 8 10 9 7 1 3 5 4 2 11 6 4 11 9 5 3 1 2 10 8 6 7 9 6 7 1 3 8 2 4 10 5 11 9 3 10 2 4 1 6 7 5 11 8 9 3 1 7 2 6 5 8 11 4 10 2 4 9 3 1 5 11 6 7 8 10 3 4 11 10 8 6 1 5 2 7 9 4 11 7 6 8 1 10 9 3 5 2 8 7 4 9 10 3 1 5 2 6 11
output:
Yes 3 6 9 7 4 8 5 10 1 2 No Yes 9 5 4 7 8 1 2 10 6 3 Yes 6 8 7 2 5 3 9 4 1 10 Yes 9 6 4 8 10 5 7 1 3 2 No No No No No No
result:
ok n=11, yes=4, no=7
Test #13:
score: 0
Accepted
time: 0ms
memory: 5764kb
input:
11 4 8 10 9 6 3 1 5 2 7 11 10 8 7 4 9 1 6 11 3 2 5 3 10 11 6 1 4 5 2 7 9 8 4 9 8 3 1 6 11 7 5 2 10 8 2 11 7 3 1 5 6 10 4 9 4 9 3 6 5 1 7 10 11 2 8 4 3 6 7 1 5 8 2 9 11 10 10 7 4 1 9 8 2 3 6 11 5 10 7 2 8 5 1 11 6 4 3 9 7 6 9 8 1 11 5 4 2 3 10
output:
Yes 1 4 5 8 9 10 2 7 6 3 Yes 4 7 1 2 6 3 5 8 10 9 Yes 9 10 8 5 3 7 2 6 1 4 Yes 1 8 3 4 5 9 10 2 6 7 No Yes 5 10 8 6 7 1 4 2 9 3 Yes 1 4 6 8 3 2 9 5 7 10 No No No No
result:
ok n=11, yes=6, no=5
Test #14:
score: 0
Accepted
time: 1ms
memory: 5820kb
input:
11 8 5 9 7 6 1 10 4 2 3 11 3 6 5 11 9 7 1 2 4 10 8 2 11 3 8 1 6 7 5 4 10 9 7 5 8 6 4 9 1 2 3 10 11 6 7 8 1 2 3 11 9 10 5 4 7 4 10 9 1 2 8 5 11 3 6 10 7 5 6 11 3 1 2 9 4 8 5 2 6 8 10 1 9 3 4 7 11 5 7 3 11 8 2 1 6 9 4 10 2 3 10 4 1 11 5 7 8 9 6
output:
Yes 5 8 1 4 6 9 7 2 3 10 Yes 5 2 6 8 1 7 4 3 10 9 Yes 1 6 5 8 10 4 2 3 7 9 No Yes 1 9 3 4 6 7 5 10 2 8 No Yes 8 1 9 3 10 4 5 6 7 2 No No No No
result:
ok n=11, yes=5, no=6
Test #15:
score: 0
Accepted
time: 366ms
memory: 8252kb
input:
500 446 156 267 294 482 398 430 13 311 318 474 426 140 484 83 387 257 136 69 305 295 283 287 55 52 65 322 249 43 56 331 443 226 214 341 182 389 464 84 477 187 40 327 411 248 10 223 165 379 293 12 9 5 230 309 367 2 397 265 59 361 118 196 316 390 213 194 167 483 452 114 345 263 219 87 94 160 224 200 2...
output:
Yes 126 22 46 291 453 50 427 83 181 242 496 143 153 57 290 432 148 44 495 78 92 49 289 170 253 396 197 337 112 492 362 314 376 8 177 221 215 490 48 326 137 237 98 111 19 381 353 182 99 12 410 322 145 169 465 281 53 85 128 150 482 245 173 313 101 65 278 47 277 238 416 288 297 331 190 206 364 411 310 ...
result:
ok n=500, yes=171, no=329
Test #16:
score: 0
Accepted
time: 372ms
memory: 8340kb
input:
500 18 271 51 335 212 326 93 264 408 66 230 181 456 149 259 396 269 443 136 446 250 409 240 457 319 289 402 334 247 216 106 214 468 448 58 186 137 225 337 487 281 333 130 275 169 420 100 71 57 284 63 454 108 375 164 437 133 110 440 350 479 370 276 211 193 148 198 222 496 460 308 85 286 242 257 435 4...
output:
Yes 76 386 36 362 182 57 118 349 335 202 280 263 413 336 18 65 374 334 24 179 25 129 408 258 226 35 144 358 122 102 85 453 433 429 194 236 211 314 27 103 300 477 204 168 162 299 460 45 189 435 272 274 342 173 86 253 170 127 298 292 73 306 183 291 225 366 143 250 341 19 109 187 12 351 262 56 100 230 ...
result:
ok n=500, yes=185, no=315
Test #17:
score: 0
Accepted
time: 371ms
memory: 8292kb
input:
500 24 261 411 242 116 202 460 6 169 140 268 333 447 468 341 373 58 274 175 180 77 232 465 326 300 211 204 75 98 425 322 90 408 489 227 480 89 31 94 248 334 299 76 290 157 178 111 143 103 117 131 292 456 201 118 285 150 10 56 251 418 448 453 47 451 184 343 42 210 68 113 422 165 391 415 272 45 82 490...
output:
Yes 372 235 226 330 285 20 482 399 498 450 77 317 104 479 411 426 423 242 57 425 190 444 105 76 227 204 404 3 394 331 427 100 353 224 484 59 373 91 320 63 291 68 127 158 211 37 407 166 282 64 94 266 265 367 134 438 350 168 116 434 29 187 107 101 40 128 483 23 280 424 428 378 75 192 210 314 306 380 3...
result:
ok n=500, yes=186, no=314
Test #18:
score: 0
Accepted
time: 378ms
memory: 7936kb
input:
500 219 142 183 492 426 414 85 228 482 93 21 361 327 345 234 50 432 52 498 223 372 127 319 56 263 210 204 43 394 271 22 437 419 486 186 255 398 167 353 444 371 172 23 270 235 133 189 6 279 380 97 179 2 29 277 328 149 411 158 369 298 26 489 315 107 360 160 463 109 215 81 232 448 140 355 33 82 25 125 ...
output:
Yes 67 462 229 118 2 209 104 492 283 420 287 427 398 160 17 471 40 119 263 426 108 483 156 341 157 53 294 366 162 13 395 198 247 478 472 185 322 117 270 145 85 410 213 231 338 38 311 23 274 404 61 400 446 473 447 343 293 317 122 388 374 220 256 300 132 384 448 87 307 148 233 257 297 165 460 171 146 ...
result:
ok n=500, yes=188, no=312
Test #19:
score: 0
Accepted
time: 369ms
memory: 8528kb
input:
500 330 206 369 65 187 249 174 325 166 260 55 244 351 275 118 186 434 116 489 481 331 472 112 130 297 26 16 84 321 132 484 305 188 35 287 452 109 44 180 407 374 46 221 29 246 424 208 292 285 209 414 418 33 406 223 309 422 108 56 359 296 326 49 286 217 173 120 72 322 62 204 451 81 455 179 45 284 298 ...
output:
Yes 251 87 52 455 359 137 17 396 269 48 399 392 475 383 172 457 433 57 309 204 232 24 196 19 427 324 6 456 139 441 14 202 109 428 482 379 297 186 342 321 395 130 71 307 5 18 373 37 328 288 133 58 401 334 360 289 99 68 80 361 50 366 446 353 81 327 291 131 222 66 21 257 201 168 349 161 436 116 310 329...
result:
ok n=500, yes=175, no=325
Test #20:
score: 0
Accepted
time: 365ms
memory: 8244kb
input:
500 233 154 203 96 30 404 476 284 75 447 291 52 155 197 258 500 338 278 199 20 405 408 307 108 122 368 424 308 453 26 7 94 330 177 319 407 105 179 236 337 150 315 29 345 292 471 89 456 180 483 382 466 45 485 263 376 478 53 61 34 463 327 219 472 62 84 172 443 226 432 190 63 366 276 174 168 375 147 19...
output:
Yes 492 196 410 257 149 212 372 323 34 359 259 142 308 348 69 54 116 406 273 470 242 429 46 340 328 384 244 234 222 333 401 450 476 367 279 467 156 484 137 197 412 398 338 3 218 18 123 358 343 232 405 79 168 162 43 108 298 317 446 347 7 226 170 353 248 281 306 52 194 8 256 175 201 184 83 253 125 381...
result:
ok n=500, yes=182, no=318
Test #21:
score: 0
Accepted
time: 371ms
memory: 8200kb
input:
500 147 88 258 111 242 490 363 484 137 17 81 260 58 113 14 50 286 333 479 419 398 240 309 301 210 289 296 83 357 120 9 288 459 232 146 239 426 319 3 171 247 348 207 412 233 32 116 480 56 115 492 218 331 209 86 174 16 101 350 176 245 36 456 365 199 102 94 76 82 351 376 103 455 420 231 325 37 93 214 2...
output:
Yes 432 174 14 63 11 288 49 267 28 243 20 145 384 388 118 292 418 465 38 333 295 170 54 317 124 296 430 413 107 485 318 104 53 257 120 158 464 43 433 298 471 200 415 455 335 377 495 169 362 181 195 417 231 404 140 131 206 176 396 469 380 431 100 98 197 215 486 459 52 164 367 166 323 460 287 429 4 33...
result:
ok n=500, yes=180, no=320
Test #22:
score: 0
Accepted
time: 369ms
memory: 7716kb
input:
500 170 302 411 359 201 15 194 287 128 106 181 12 367 450 339 488 377 466 115 16 275 62 178 330 276 461 168 58 380 202 14 37 233 92 383 195 459 327 74 477 278 363 444 342 422 455 28 169 301 492 436 337 356 487 126 378 404 249 7 259 366 187 103 447 130 389 24 120 245 206 47 432 416 102 297 166 376 31...
output:
Yes 44 406 206 473 396 147 427 121 388 139 233 72 349 226 36 22 116 163 394 458 431 57 20 11 60 443 196 49 175 296 122 162 249 31 98 255 401 167 339 486 239 333 498 318 422 6 204 314 165 106 5 402 105 152 445 456 234 13 336 291 375 441 465 243 130 449 181 193 374 313 371 463 322 331 137 208 397 300 ...
result:
ok n=500, yes=174, no=326
Test #23:
score: 0
Accepted
time: 370ms
memory: 7732kb
input:
500 498 451 475 72 77 397 157 119 386 312 321 45 71 21 24 438 186 26 341 408 39 195 275 366 100 144 70 95 246 4 46 361 182 155 473 387 23 335 6 413 292 416 89 266 2 457 450 213 367 22 92 382 237 170 251 500 254 309 136 323 27 42 222 481 111 169 188 371 166 150 434 427 208 209 398 430 165 295 238 258...
output:
Yes 310 481 150 385 158 460 418 247 306 434 3 365 279 435 404 124 489 133 138 270 423 292 319 92 11 421 226 382 391 451 297 44 168 145 1 330 232 286 492 395 198 257 155 93 316 27 346 80 457 182 127 339 52 189 55 366 373 221 381 205 239 411 148 6 250 291 143 478 443 217 26 465 410 359 31 437 30 471 1...
result:
ok n=500, yes=187, no=313
Test #24:
score: 0
Accepted
time: 367ms
memory: 8316kb
input:
500 74 364 86 239 403 250 29 92 464 201 114 394 231 279 59 217 343 242 225 255 48 154 404 103 183 18 159 147 137 222 75 172 458 362 39 99 396 149 100 428 259 318 53 460 76 163 146 444 342 184 143 296 262 186 148 175 165 241 294 218 254 482 16 488 169 78 27 101 311 63 14 258 117 60 393 107 410 145 10...
output:
Yes 32 196 64 400 125 227 405 390 181 380 445 287 371 369 330 43 38 360 428 71 245 362 447 470 473 162 89 222 393 124 309 423 342 210 368 75 15 237 104 367 66 1 303 492 471 99 204 326 262 2 19 82 207 378 271 116 241 126 208 156 376 72 274 305 484 102 300 198 8 76 53 144 115 338 221 286 35 451 454 38...
result:
ok n=500, yes=177, no=323
Test #25:
score: -100
Time Limit Exceeded
input:
500 468 261 329 368 419 490 308 362 265 282 392 397 306 281 384 325 263 319 448 449 277 333 323 394 351 472 442 260 374 400 274 264 423 278 369 380 403 303 406 470 295 318 326 268 371 339 491 390 444 481 421 459 393 347 383 408 257 324 286 267 253 436 483 460 427 320 388 297 287 363 288 358 361 331 ...
output:
No Yes 324 120 460 70 396 71 459 234 217 211 279 493 472 223 63 249 75 302 278 331 256 402 51 214 299 110 212 420 393 294 366 377 156 158 80 85 261 107 363 242 416 227 347 325 318 383 327 55 103 499 298 18 147 69 400 349 58 378 310 471 143 121 253 26 167 87 28 207 68 395 309 91 361 98 104 343 33 219...