QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#432046 | #370. City | Zpair | 8 | 64ms | 12060kb | C++20 | 1.0kb | 2024-06-06 16:58:48 | 2024-06-06 16:58:49 |
Judging History
Encoder
#include "Encoder.h"
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
const db q=1.025;
const int N=2e5+5;
vector<int> e[N];
int f[550],siz[N],mp[N],tot;
void dfs(int p,int fa){
mp[p]=++tot;
siz[p]=1;
for(int t:e[p]){
if(t==fa)continue;
dfs(t,p),siz[p]+=siz[t];
}
int pos=lower_bound(f,f+520,siz[p])-f;
tot+=f[pos]-siz[p];siz[p]=f[pos];
Code(p,pos|((ll)mp[p]<<9));
}
void Encode(int N,int A[],int B[]) {
for(int i=0;i<N-1;++i) {
e[A[i]].push_back(B[i]);
e[B[i]].push_back(A[i]);
}
f[0]=1;
for(int i=1;i<520;++i)
f[i]=max(f[i-1]+1.0,f[i-1]*q);
dfs(0,-1);
}
Device
#include "Device.h"
#include<bits/stdc++.h>
using namespace std;
typedef double db;
const db q=1.025;
const int N=2e5+5;
int ff[550];
void InitDevice(){
ff[0]=1;
for(int i=1;i<520;++i)
ff[i]=max(ff[i-1]+1.0,ff[i-1]*q);
}
int Answer(long long S,long long T){
int d1=S>>9,s1=ff[S&511];
int d2=T>>9,s2=ff[T&511];
if(d2<=d1&&d1<=d2+s2-1)return 0;
if(d1<=d2&&d2<=d1+s1-1)return 1;
return 2;
}
详细
Subtask #1:
score: 8
Accepted
Test #1:
score: 8
Accepted
time: 0ms
memory: 11936kb
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:
521 3072 2050 4608 4097 1025 3587 1536 2560 5120
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 5120
result:
ok
Test #2:
score: 8
Accepted
time: 4ms
memory: 11992kb
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:
521 4096 2048 3072 5120 4609 1538 1028 3585 2560
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 5120
result:
ok
Test #3:
score: 8
Accepted
time: 2ms
memory: 9948kb
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:
521 4096 3584 2564 4608 5120 3075 2054 1536 1025
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 5120
result:
ok
Test #4:
score: 8
Accepted
time: 2ms
memory: 10412kb
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:
521 2048 4096 1026 3072 3585 5120 2565 1536 4609
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 5120
result:
ok
Test #5:
score: 8
Accepted
time: 0ms
memory: 11988kb
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:
521 4608 3072 5120 3584 2562 2048 1029 1537 4098
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 5120
result:
ok
Test #6:
score: 8
Accepted
time: 0ms
memory: 12000kb
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:
520 4096 4608 2563 2053 1536 3073 1025 3584
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 4608
result:
points 1.0
Test #7:
score: 8
Accepted
time: 2ms
memory: 10012kb
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:
521 3074 2560 5120 1538 1024 3584 2048 4096 4609
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 5120
result:
ok
Test #8:
score: 8
Accepted
time: 4ms
memory: 11988kb
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:
516 1536 2049 2560 1025
input:
Interaction has been finished!
output:
1 0 0 0 2 1 2 2 1 2 2560
result:
points 1.0
Test #9:
score: 8
Accepted
time: 2ms
memory: 11996kb
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:
518 2048 2562 3584 1537 3073 1024
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 3584
result:
points 1.0
Test #10:
score: 8
Accepted
time: 4ms
memory: 11992kb
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:
519 2560 2050 1024 3072 3584 4096 1540
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 4096
result:
points 1.0
Test #11:
score: 8
Accepted
time: 0ms
memory: 12060kb
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:
517 1539 2560 1024 2049 3072
input:
Interaction has been finished!
output:
0 1 0 1 1 1 0 2 0 2 2 2 2 0 2 3072
result:
points 1.0
Test #12:
score: 8
Accepted
time: 2ms
memory: 10628kb
input:
4 6 0 2 2 3 0 1 0 1 0 2 0 3 2 1 3 1 3 2
output:
515 2048 1025 1536
input:
Interaction has been finished!
output:
1 1 1 2 2 0 2048
result:
points 1.0
Subtask #2:
score: 0
Stage 1: Program Program Runtime Error
Test #13:
score: 92
Accepted
time: 60ms
memory: 10000kb
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:
689 243713 291840 99840 333825 185346 346625 254976 226816 358912 306178 245248 139776 16385 335872 294913 177152 326145 326656 82944 222723 149014 126976 187392 221184 201216 65536 11778 4608 354816 86017 304640 330242 300544 324097 166425 117248 68608 233472 13312 253446 144384 99328 172545 336897...
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 1.0
Test #14:
score: 92
Accepted
time: 64ms
memory: 12024kb
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:
690 199680 293889 183808 146944 78849 133632 176642 180738 159745 267267 1200 37888 39938 208384 224770 265216 261120 300032 37377 237580 50176 286208 18433 101377 30720 22019 211459 288256 26115 74752 254469 103942 94216 135682 346624 51718 312832 302593 319489 65536 240640 24584 327168 242176 2161...
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 1.0
Test #15:
score: 92
Accepted
time: 64ms
memory: 10384kb
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:
689 101376 249344 229376 51742 337414 299520 164352 25601 66561 106518 18950 330240 239104 107521 130048 105984 166912 119304 22540 68608 145409 277505 188416 348160 121344 79873 272896 16896 87041 243712 186386 192513 361475 251392 235009 138244 307200 33280 48131 318487 84992 214528 177675 312835 ...
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 1.0
Test #16:
score: 92
Accepted
time: 64ms
memory: 10096kb
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:
689 162304 355328 348678 162816 281088 120320 102912 56322 3102 175104 212486 332806 15366 260610 134718 216091 85006 55814 93190 278534 318976 352770 68638 301058 310274 200718 295424 179712 226304 33792 202240 348174 273920 28162 262658 335360 153600 242190 316930 124416 109574 153088 135694 24678...
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 1.0
Test #17:
score: 0
Stage 1: Program Program Runtime Error
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...