QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#566887 | #370. City | makrav | 8 | 130ms | 8544kb | C++20 | 858b | 2024-09-16 02:56:04 | 2024-09-16 02:56:04 |
Judging History
Encoder
#include "Encoder.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
void Encode(int N, int A[], int B[])
{
vector<int> tin(N), tout(N);
vector<vector<int>> g(N);
for (int i = 0; i < N - 1; i++) {
g[A[i]].pb(B[i]);
g[B[i]].pb(A[i]);
}
int tim =0;
auto dfs = [&](int v, int p, auto &&self) -> void {
tin[v] = tim++;
for (auto &u : g[v]) {
if (u != p) self(u, v, self);
}
tout[v] = tim++;
};
dfs(0, 0, dfs);
for (int i = 0; i < N; i++) {
Code(i, tin[i] * 1ll * 500000ll + tout[i]);
}
}
Device
#include "Device.h"
void InitDevice()
{
}
int Answer(long long S, long long T)
{
int tin1 = S / 500000, tout1 = S % 500000, tin2 = T / 500000, tout2 = T % 500000;
if (tin1 <= tin2 && tout2 <= tout1) {
return 1;
}
if (tin2 <= tin1 && tout1 <= tout2) return 0;
return 2;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 8
Accepted
Test #1:
score: 8
Accepted
time: 2ms
memory: 5884kb
input:
10 45 0 5 0 2 4 3 6 4 0 6 2 8 6 9 2 1 5 7 5 0 0 2 8 0 0 7 0 6 1 0 4 0 0 3 0 9 5 2 5 8 7 5 5 6 1 5 4 5 5 3 9 5 8 2 7 2 2 6 2 1 2 4 3 2 2 9 7 8 6 8 8 1 8 4 3 8 9 8 6 7 1 7 4 7 3 7 9 7 1 6 6 4 6 3 6 9 4 1 1 3 9 1 3 4 9 4 9 3
output:
19 4000009 2500010 6500014 6000015 500004 5500018 1000003 3000007 8000017
input:
Interaction has been finished!
output:
0 1 0 1 1 0 0 1 1 2 2 0 2 2 2 2 2 0 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 2 2 2 0 2 2 8000017
result:
ok
Test #2:
score: 8
Accepted
time: 0ms
memory: 6148kb
input:
10 45 6 2 0 7 6 9 7 6 0 8 5 4 8 1 7 3 0 5 7 0 0 5 8 0 0 3 6 0 0 1 0 9 4 0 0 2 5 7 8 7 7 3 6 7 7 1 7 9 4 7 7 2 5 8 5 3 5 6 1 5 9 5 4 5 2 5 8 3 6 8 1 8 9 8 8 4 2 8 3 6 3 1 9 3 4 3 2 3 6 1 9 6 4 6 2 6 1 9 1 4 2 1 4 9 9 2 4 2
output:
19 6000013 1500004 4000009 8000017 7500018 1000007 500010 5500014 2500006
input:
Interaction has been finished!
output:
0 1 0 1 0 1 1 0 1 2 2 1 0 2 1 2 1 2 2 2 2 2 0 2 2 2 0 2 2 2 2 2 2 2 2 2 0 2 0 2 2 2 2 2 2 8000017
result:
ok
Test #3:
score: 8
Accepted
time: 2ms
memory: 6108kb
input:
10 45 0 9 0 7 7 3 6 2 6 1 9 8 6 4 7 5 3 6 7 0 9 0 3 0 0 6 4 0 1 0 8 0 0 2 0 5 9 7 7 3 7 6 7 4 1 7 8 7 2 7 7 5 9 3 9 6 4 9 1 9 8 9 9 2 5 9 3 6 4 3 1 3 3 8 2 3 5 3 4 6 6 1 8 6 2 6 6 5 4 1 4 8 4 2 5 4 8 1 1 2 1 5 2 8 5 8 2 5
output:
19 5000011 4000009 3000015 6000013 8000017 3500014 2500018 1000003 500004
input:
Interaction has been finished!
output:
0 0 0 1 0 0 0 1 1 2 1 1 1 0 2 0 1 2 2 2 2 0 2 2 1 0 0 2 0 2 0 1 2 0 2 2 2 2 2 2 2 2 2 2 2 8000017
result:
ok
Test #4:
score: 8
Accepted
time: 2ms
memory: 8192kb
input:
10 45 3 8 9 6 7 4 7 5 7 9 5 2 0 3 3 1 0 7 7 0 3 0 0 9 6 0 1 0 8 0 0 5 0 2 4 0 7 3 9 7 7 6 1 7 7 8 7 5 2 7 7 4 9 3 6 3 1 3 8 3 5 3 3 2 4 3 9 6 9 1 8 9 5 9 2 9 9 4 1 6 6 8 6 5 2 6 4 6 1 8 5 1 1 2 1 4 8 5 2 8 8 4 5 2 4 5 2 4
output:
19 2000005 5500012 500006 4000009 5000013 7500016 3500018 1000003 7000017
input:
Interaction has been finished!
output:
0 0 1 0 0 0 1 1 0 2 0 1 2 2 1 0 1 2 2 0 0 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 7500016
result:
ok
Test #5:
score: 8
Accepted
time: 0ms
memory: 4064kb
input:
10 45 8 7 6 8 7 0 2 5 9 0 4 5 1 9 3 9 5 7 7 0 0 9 0 5 0 8 3 0 0 1 2 0 4 0 0 6 7 9 7 5 8 7 7 3 1 7 2 7 7 4 6 7 5 9 9 8 3 9 1 9 2 9 9 4 9 6 5 8 5 3 1 5 2 5 5 4 5 6 3 8 1 8 2 8 8 4 6 8 3 1 2 3 4 3 6 3 2 1 1 4 6 1 4 2 6 2 4 6
output:
19 7000015 3500008 8000017 4500010 3000011 1500004 500012 1000005 6500018
input:
Interaction has been finished!
output:
0 1 1 1 0 1 0 0 1 2 1 0 2 2 0 1 0 2 2 0 0 2 2 2 2 2 2 0 1 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 8000017
result:
ok
Test #6:
score: 8
Accepted
time: 0ms
memory: 4096kb
input:
9 36 3 6 4 3 6 8 4 2 3 1 0 7 0 4 7 5 7 0 5 0 0 4 0 3 2 0 1 0 6 0 0 8 7 5 4 7 3 7 2 7 1 7 6 7 8 7 5 4 5 3 5 2 5 1 6 5 8 5 3 4 4 2 4 1 4 6 8 4 2 3 3 1 6 3 8 3 1 2 2 6 2 8 1 6 8 1 6 8
output:
17 5500012 7000015 3000013 2500016 1000003 3500010 500004 4000009
input:
Interaction has been finished!
output:
0 0 1 1 0 0 0 1 1 2 2 2 2 2 2 2 2 2 2 2 2 0 1 1 1 0 2 1 0 0 2 2 2 2 2 1 7000015
result:
points 1.0
Test #7:
score: 8
Accepted
time: 2ms
memory: 5908kb
input:
10 45 0 5 4 7 4 2 0 4 1 6 0 1 1 8 0 9 9 3 0 1 4 0 2 0 0 8 0 6 0 9 5 0 3 0 7 0 1 4 1 2 8 1 1 6 1 9 5 1 1 3 7 1 2 4 4 8 4 6 9 4 4 5 3 4 4 7 2 8 2 6 9 2 5 2 2 3 7 2 6 8 8 9 8 5 3 8 8 7 9 6 6 5 6 3 6 7 9 5 3 9 9 7 3 5 5 7 3 7
output:
19 4500014 3000007 8000017 1500008 500002 5000011 2000005 6000013 7500018
input:
Interaction has been finished!
output:
1 0 0 1 1 1 0 0 0 2 2 0 1 2 2 2 2 0 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 8000017
result:
ok
Test #8:
score: 8
Accepted
time: 2ms
memory: 5796kb
input:
5 10 4 1 0 4 0 2 2 3 0 4 2 0 1 0 3 0 2 4 4 1 4 3 1 2 2 3 1 3
output:
9 1000003 2500008 3000007 500004
input:
Interaction has been finished!
output:
1 0 0 0 2 1 2 2 1 2 3000007
result:
points 1.0
Test #9:
score: 8
Accepted
time: 0ms
memory: 4088kb
input:
7 21 4 1 2 5 0 6 0 4 0 2 5 3 0 4 1 0 0 6 0 2 0 5 3 0 4 1 6 4 2 4 4 5 4 3 6 1 1 2 1 5 1 3 2 6 5 6 3 6 2 5 2 3 5 3
output:
13 2000005 3500012 4500010 1500006 4000011 500002
input:
Interaction has been finished!
output:
1 0 1 1 1 0 1 2 2 2 2 2 2 2 2 2 2 2 1 1 1 4500010
result:
points 1.0
Test #10:
score: 8
Accepted
time: 2ms
memory: 6152kb
input:
8 28 7 2 2 1 0 3 2 4 7 5 0 7 0 6 0 3 0 6 0 7 0 2 5 0 0 4 0 1 6 3 7 3 2 3 5 3 4 3 1 3 7 6 2 6 6 5 4 6 6 1 7 2 7 5 4 7 1 7 5 2 2 4 1 2 4 5 5 1 4 1
output:
15 2500006 2000009 500002 3500008 5000011 6500014 1500012
input:
Interaction has been finished!
output:
1 1 1 1 0 1 1 2 2 2 2 2 2 2 2 2 2 2 1 1 0 0 2 1 0 2 2 2 6500014
result:
points 1.0
Test #11:
score: 8
Accepted
time: 0ms
memory: 4064kb
input:
6 15 0 3 1 4 1 5 4 2 0 1 1 0 0 5 4 0 0 3 0 2 1 5 4 1 1 3 2 1 5 4 3 5 5 2 3 4 2 4 3 2
output:
11 1500010 2500006 500002 2000007 4000009
input:
Interaction has been finished!
output:
0 1 0 1 1 1 0 2 0 2 2 2 2 0 2 4000009
result:
points 1.0
Test #12:
score: 8
Accepted
time: 0ms
memory: 3792kb
input:
4 6 0 2 2 3 0 1 0 1 0 2 0 3 2 1 3 1 3 2
output:
7 2500006 500004 1000003
input:
Interaction has been finished!
output:
1 1 1 2 2 0 2500006
result:
points 1.0
Subtask #2:
score: 0
Wrong Answer
Test #13:
score: 78.2031
Acceptable Answer
time: 54ms
memory: 6024kb
input:
700 244650 407 643 680 336 573 208 466 455 159 648 575 549 50 567 251 211 211 481 530 513 136 334 112 492 175 396 643 483 265 132 20 160 174 550 251 90 99 236 579 374 670 613 495 379 251 170 652 61 495 467 27 317 202 484 420 592 542 354 565 650 35 88 216 681 277 219 299 171 220 647 418 433 434 660 2...
output:
1399 467500938 557501116 189500380 640501284 356000717 666001335 489500980 436500874 690001381 584501174 471500944 266500534 26500056 644001289 563501130 338500678 627001257 627501256 157500316 429500866 287000619 242000485 360000721 426500854 387000775 124000249 19000043 5500012 681501364 163500330...
input:
Interaction has been finished!
output:
0 0 0 0 1 0 1 1 1 1 0 0 1 0 1 1 1 0 1 1 1 1 0 1 1 0 1 0 0 1 1 1 0 1 1 1 1 1 1 0 1 0 0 0 0 1 1 0 0 1 1 0 1 1 0 0 0 1 1 0 0 1 0 0 1 0 0 0 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 0 0 0 1 1 0 0 1 0 1 1 0 1 0 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 1 1 0 0 1 0 0 1 0 1 0 0 0 1 0 0 1 0 1 1 1 1 1 0 1 0 0 0 1 0 0 0 0 1 ...
result:
points 0.85003393870
Test #14:
score: 78.2756
Acceptable Answer
time: 64ms
memory: 4704kb
input:
699 243951 59 192 191 301 270 524 135 496 647 573 174 262 662 43 371 50 655 434 123 242 209 46 612 646 11 533 156 443 322 462 329 558 417 383 283 263 615 504 29 520 391 135 546 535 54 264 382 651 541 427 536 456 295 169 645 303 494 21 282 179 329 490 191 67 697 55 226 276 32 160 226 482 392 56 144 1...
output:
1397 384500770 566501136 351000703 279500560 150000303 254000509 338500682 346000697 305500614 514501036 501346 70500142 74000153 401500804 430000865 510501022 502501006 578501158 70000143 457500940 92500186 551001103 31000065 193000389 56000113 40000087 406500820 555001111 47000101 142000285 490000...
input:
Interaction has been finished!
output:
1 0 1 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 0 0 1 1 1 0 0 1 0 1 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 0 1 1 0 0 0 1 0 1 1 0 1 1 1 0 0 0 0 1 0 1 0 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 1 1 0 1 1 1 1 0 1 0 1 0 0 1 1 1 0 0 1 1 0 0 1 0 0 ...
result:
points 0.8508216710
Test #15:
score: 78.2341
Acceptable Answer
time: 64ms
memory: 6564kb
input:
700 244650 32 619 369 483 58 148 484 103 190 630 589 659 90 204 515 464 215 254 688 658 454 3 286 582 158 246 90 164 648 13 602 240 237 8 36 620 31 558 515 560 302 39 373 418 288 388 50 516 26 514 190 467 190 439 600 35 258 421 148 214 251 111 50 62 10 530 624 466 666 637 666 692 285 650 137 686 280...
output:
1399 192000385 480000961 442000885 97000255 643501300 576501154 314000629 45000093 125000253 204500454 33000079 630501262 459000919 205500414 248500498 202500406 319500640 229500476 40000105 129000259 279000561 534501072 362500726 667001335 232500466 152000307 525501052 29500060 166500336 467500936 ...
input:
Interaction has been finished!
output:
1 1 0 1 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 1 1 1 1 1 0 1 0 1 0 1 1 0 1 1 1 1 1 0 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 0 0 1 1 1 0 1 0 1 0 1 1 0 0 1 1 0 1 1 1 1 1 0 1 0 1 0 0 0 1 1 0 1 1 0 1 0 0 1 0 1 0 1 0 1 1 0 0 0 0 0 1 0 1 1 1 0 0 0 1 0 0 0 1 1 1 1 1 1 0 0 1 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 ...
result:
points 0.85037105380
Test #16:
score: 78.2756
Acceptable Answer
time: 64ms
memory: 4800kb
input:
700 244650 230 624 291 145 565 474 12 535 152 335 438 692 136 13 199 155 255 47 546 152 293 254 427 131 71 388 31 231 124 522 503 23 320 545 322 480 674 535 247 415 301 163 226 63 560 367 361 103 391 149 483 661 262 632 337 79 45 59 182 489 526 425 275 369 256 598 42 487 125 63 661 23 181 152 366 29...
output:
1399 308000617 680001361 668001349 309000619 536001073 228500458 194500390 105000215 2500066 332500666 406500826 637001287 25500064 496500998 256500638 414500884 161000351 104500222 176500366 532001077 609001219 675501356 129500320 574501154 592501190 384000797 564001129 341500684 432500866 60500122...
input:
Interaction has been finished!
output:
1 0 1 1 0 1 1 0 1 0 0 1 0 1 1 1 0 1 0 1 0 0 1 0 1 1 0 1 0 1 0 1 0 0 1 0 0 0 1 0 1 1 1 0 0 1 0 0 0 0 1 0 0 1 1 1 0 0 0 1 0 0 0 0 1 1 1 0 1 0 0 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 0 1 0 0 0 0 0 1 0 1 1 1 0 1 1 0 0 1 0 0 0 1 1 1 1 1 0 1 1 1 0 0 1 1 0 0 0 1 0 0 1 0 1 1 1 0 1 0 0 1 0 1 0 1 ...
result:
points 0.8508216710
Test #17:
score: 0
Wrong Answer
time: 130ms
memory: 8544kb
input:
250000 250000 98377 99261 85304 211210 196850 193036 80796 130416 3160 72100 145991 142897 200915 46448 218676 213491 89680 96159 73896 8598 61659 226081 22401 122629 228272 20662 17177 215756 118511 136128 95692 43162 78229 30135 134970 150179 163578 188576 213241 99059 203107 94390 139934 51361 18...
output:
499999 -606642982 -1068607087 1717577078 2119238584 1103580323 -615877349 2067986245 850318636 2096362420 -177174475 1202067101 -1616897241 2027486164 -1818925522 136995802 -2092347950 482042259 918690418 -437605823 547107087 -1906673459 1554292167 1717998964 342152444 -1022510990 2912952 189899901 ...
input:
Interaction has been finished!
output:
2 2 2 2 2 0 0 0 2 1 2 1 2 0 2 0 1 2 0 0 1 1 1 0 1 0 1 2 2 2 1 2 2 0 0 1 2 2 2 2 1 2 2 2 1 0 0 2 1 1 0 1 0 1 2 1 0 2 0 0 2 2 1 2 1 0 2 1 1 1 2 1 0 0 2 2 2 2 2 2 2 1 2 1 1 2 2 2 1 2 1 2 1 0 0 0 0 1 0 1 0 1 1 1 1 0 0 1 0 2 0 2 0 2 0 1 2 1 1 0 0 2 0 1 1 2 2 1 2 0 1 1 1 2 0 1 0 1 1 1 0 2 2 2 0 0 2 2 2 0 ...
result:
wrong answer Wrong Answer [6] (Query #3 returned 2 but expected 1)