QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#302086 | #370. City | Xttttr | 8 | 128ms | 9832kb | C++14 | 1.6kb | 2024-01-10 16:07:50 | 2024-01-10 16:07:50 |
Judging History
Encoder
#include<bits/stdc++.h>
#include "Encoder.h"
#define ll long long
using namespace std;
namespace encode{
const int M=250052;
const double q=0.23;
int n,cnt,ver[M<<1],nxt[M<<1],h[M],cntdfn,dfn[M],siz[M];
int f[M];
inline void init(){
f[0]=1;
for(int i=1;i<512;i++)f[i]=min(1<<20,(int)max(1.0,q*f[i-1])+f[i-1]);
}
inline void add_edge(int x,int y){cnt++;ver[cnt]=y;nxt[cnt]=h[x];h[x]=cnt;}
inline void dfs(int x){
dfn[x]=++cntdfn;
siz[x]=1;
for(int i=h[x];i;i=nxt[i]){
int y=ver[i];
if(!dfn[y]){
dfs(y);
siz[x]+=siz[y];
}
}
int p=lower_bound(f,f+512,siz[x])-f;
siz[x]=f[p];
cntdfn=dfn[x]+siz[x]-1;
Code(x,512ll*dfn[x]+p);
}
}
void Encode(int N,int A[],int B[]){
using namespace encode;
n=N;
init();
for(int i=0;i<n-1;i++){
add_edge(A[i],B[i]),add_edge(B[i],A[i]);
}
dfs(0);
}
Device
#include<bits/stdc++.h>
#include "Device.h"
using namespace std;
namespace device{
const int M=250052;
const double q=0.23;
int f[M];
inline void init(){
f[0]=1;
for(int i=1;i<512;i++)f[i]=min(1<<20,(int)max(1.0,q*f[i-1])+f[i-1]);
}
}
void InitDevice(){
using namespace device;
init();
}
int Answer(long long S,long long T){
using namespace device;
int dfns=S>>9,sizs=f[S&511ll],dfnt=T>>9,sizt=f[T&511ll];
if(dfnt<dfns&&dfns<dfnt+sizt)return 0;
if(dfns<dfnt&&dfnt<dfns+sizs)return 1;
return 2;
}
详细
Subtask #1:
score: 8
Accepted
Test #1:
score: 8
Accepted
time: 0ms
memory: 7708kb
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 3584 3074 2560 2049 4609 1027 5120 4096 1536
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: 2ms
memory: 7780kb
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 2560 5120 3584 1536 1025 4098 3076 2049 4608
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: 7832kb
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 3584 4096 2052 3072 1536 2563 1030 5120 4609
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: 7772kb
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 4608 3072 4098 3584 2561 2048 1029 5120 1537
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: 7896kb
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 2048 4096 1536 3584 3074 5120 2565 4609 1026
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: 7756kb
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 2560 1536 2051 1029 4608 3073 4097 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: 7776kb
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 2050 4096 1536 3586 5120 3072 4608 2560 1025
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: 2ms
memory: 5732kb
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 2560 1025 1536 2049
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: 0ms
memory: 7772kb
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 3072 1026 2048 2561 1537 3584
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: 2ms
memory: 5724kb
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 3584 2562 4096 3072 2048 1024 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: 2ms
memory: 7756kb
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 1027 2560 3072 2049 1536
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: 0ms
memory: 7784kb
input:
4 6 0 2 2 3 0 1 0 1 0 2 0 3 2 1 3 1 3 2
output:
515 1024 1537 2048
input:
Interaction has been finished!
output:
1 1 1 2 2 0 2048
result:
points 1.0
Subtask #2:
score: 0
Wrong Answer
Test #13:
score: 92
Accepted
time: 56ms
memory: 7892kb
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:
544 137729 80384 315392 34305 213506 19969 124928 169984 6144 64002 135680 272384 418305 33280 76801 225792 40961 41472 337408 171523 247310 285696 212480 175104 198656 355328 422402 431616 10752 333825 65536 36354 70144 43521 221198 297472 353280 161792 421888 121862 267264 315904 228865 30209 3635...
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: 54ms
memory: 7776kb
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:
545 215040 84481 235520 283136 364545 299008 240130 236546 259585 112131 14368 413184 406530 205312 166914 115712 120832 75776 412673 137738 397824 94720 472577 342529 459264 465923 187907 91136 462851 369152 124421 330758 345096 294402 19456 392198 53760 68097 47617 380928 141824 460296 40448 14131...
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: 62ms
memory: 7776kb
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:
544 363008 138240 160256 406543 32262 74752 235520 455681 407553 342030 458758 42496 149504 353281 329728 356864 231936 334344 452106 406016 310273 102913 205824 22016 337408 392193 108544 463360 376833 145408 198157 201729 3587 136704 155137 316420 67072 446464 425475 41486 379392 177152 213002 599...
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: 56ms
memory: 7768kb
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:
545 283136 12288 14854 282624 105984 333824 352256 414722 458255 258048 211462 31750 459270 129026 276499 193551 365579 412678 361990 104454 53760 13314 374287 71170 61954 218635 90624 253440 199168 443904 225792 10763 113152 448002 126978 33280 291840 141323 54274 329728 341510 292352 302091 143874...
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: 89.2964
Acceptable Answer
time: 126ms
memory: 9816kb
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:
575 67188226 1788929 164120576 77665280 251894784 311043072 50792448 69513217 64117760 226798080 33480192 32390145 50818048 254617600 260494848 159631362 318019072 20469761 1073666 29969921 287398401 288116736 259107328 93079553 178489856 273202691 61005824 98558976 254523393 49789953 133576704 3144...
input:
Interaction has been finished!
output:
2 2 1 1 2 0 0 0 2 1 2 0 2 0 2 0 1 0 0 2 1 2 2 0 2 0 0 2 2 2 1 2 2 2 2 1 1 2 2 1 1 2 0 1 1 0 0 2 2 1 0 1 0 2 2 1 1 2 0 1 2 2 2 0 2 0 1 1 1 1 2 2 0 0 2 2 2 2 2 0 2 2 2 2 1 2 2 2 1 2 1 0 2 0 0 0 0 1 2 1 2 1 1 1 1 0 0 0 2 2 0 2 1 2 2 2 2 2 2 0 1 2 2 2 0 2 2 1 0 2 1 2 2 2 0 1 0 1 1 2 1 2 2 0 0 2 1 2 2 1 ...
result:
points 0.97061288090
Test #18:
score: 86.1698
Acceptable Answer
time: 128ms
memory: 9824kb
input:
250000 250000 58662 187031 88005 38197 22682 178770 111851 15764 207630 198631 64191 185171 168598 129456 142337 237430 215849 182270 211116 93208 20 204879 130122 42963 11672 121189 75991 33257 87185 128123 33289 2936 144056 47212 140138 18041 2913 20891 194901 213077 39452 3187 187440 25628 73551 ...
output:
577 33779201 151786496 264309248 365335552 145376256 82715657 16294404 100613120 143368704 43093506 308083203 19067393 132315140 145105922 146308115 137903616 299201536 199000580 256203785 329269254 21800448 204857345 153476608 216007168 319380484 85049857 152875010 299216898 29435393 329018882 7003...
input:
Interaction has been finished!
output:
1 0 2 1 2 2 2 0 1 2 1 2 0 0 1 1 0 2 2 2 1 2 1 1 2 1 2 0 2 1 1 2 1 2 2 2 0 0 1 1 2 1 2 2 2 2 2 1 0 1 0 2 2 1 2 0 1 0 2 1 1 2 0 0 1 1 1 2 1 0 1 2 0 2 2 2 0 2 0 0 2 2 1 1 1 0 2 0 0 2 2 1 1 0 1 0 2 0 0 1 2 2 2 2 2 2 0 2 2 1 1 2 0 1 2 2 1 0 2 2 1 0 2 2 2 1 1 2 2 0 1 1 2 2 1 2 1 2 1 2 2 2 2 1 1 0 0 2 0 0 ...
result:
points 0.93662822650
Test #19:
score: 87.9603
Acceptable Answer
time: 122ms
memory: 9832kb
input:
250000 250000 212557 2865 205598 91456 106547 166169 2385 60328 54909 26698 82002 112166 121929 240217 123410 133417 93989 61456 92642 225604 49143 8681 1263 131585 214794 141276 12589 67655 51160 187118 83743 12235 86483 172453 29872 111146 249757 78807 216189 2378 57530 180918 106038 234952 16366 ...
output:
576 81673728 297718281 72605191 183586304 31607298 309749248 91236352 209196546 277500928 319279616 118820864 33229825 13621780 75516928 295865351 318921737 80939526 14426112 223770624 263891968 171920896 97042432 168725504 184620032 295853060 278650372 214209537 17831424 42903552 41352192 310771200...
input:
Interaction has been finished!
output:
1 1 2 1 2 2 2 0 0 2 1 1 2 2 2 0 0 2 1 1 0 0 0 2 0 1 1 2 2 2 1 2 0 1 2 1 2 1 1 0 2 2 2 2 2 0 2 1 1 2 2 1 2 0 1 2 1 2 1 1 2 2 2 0 0 2 2 1 2 2 1 2 1 2 2 0 1 2 2 2 0 0 0 2 2 0 0 2 2 2 2 2 2 1 2 0 2 1 2 2 2 1 2 0 2 0 1 1 2 0 1 2 2 0 2 2 2 2 1 0 0 2 1 1 2 2 2 0 0 2 0 1 1 2 2 2 0 0 1 2 0 0 1 1 2 2 2 2 1 1 ...
result:
points 0.95609055210
Test #20:
score: 0
Wrong Answer
time: 116ms
memory: 9832kb
input:
250000 250000 108989 180679 6618 123314 146792 97095 101695 18624 109138 21259 130176 235020 131970 224224 32023 110376 126943 90247 7024 8229 55250 106561 44259 206501 157785 107293 88446 38793 62937 119441 158397 243678 83221 104131 184687 105512 101778 195126 76695 8559 31678 182822 58730 237755 ...
output:
1024 157248000 15871490 475591682 537259035 1242114 487884288 356489728 424652800 146409472 206921216 143101440 237798400 532756480 506552320 537184256 490779667 516207616 477688832 369926662 421945856 65958400 392952832 34141696 516754944 174010880 246667266 188927494 330354688 360748550 92414464 1...
input:
Interaction has been finished!
output:
0 2 2 2 0 1 2 0 2 2 1 0 1 1 2 2 0 0 2 1 2 2 1 2 1 0 2 2 2 2 2 2 2 1 2 2 1 2 0 0 2 2 0 2 2 2 2 0 1 0 1 2 2 2 0 2 0 2 0 2 2 2 2 0 1 2 2 0 2 0 2 2 2 0 2 1 2 2 2 0 0 2 2 2 2 0 1 2 0 1 0 2 1 2 2 2 2 2 0 2 2 2 1 2 2 1 2 0 2 1 0 1 2 2 1 1 2 2 1 2 2 2 2 0 1 2 0 2 2 2 2 1 2 2 1 2 2 2 2 2 1 2 0 2 2 2 1 1 2 1 ...
result:
wrong answer Wrong Answer [6] (Query #126 returned 2 but expected 1)