QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#672693 | #6978. Tower | KiharaTouma# | 32.817949 | 5ms | 3932kb | C++14 | 990b | 2024-10-24 18:09:54 | 2024-10-24 18:09:56 |
Judging History
answer
//qoj6978
#include <bits/stdc++.h>
using namespace std;
const int N = 100;
int T, x[N], y[N], tp;
typedef long long ll;
ll q;
int main(){
scanf("%d", &T);
while(T--){
scanf("%lld", &q);
tp = 0;
if(q == 1){
puts("0");
continue;
}
ll p = 1;
++ tp;
x[tp] = y[tp] = 1;
while(p * 2 <= q){
++ tp;
x[tp] = 1;
y[tp] = tp;
p *= 2;
}
if(q != p){
int nw = tp;
for(int i = 0; i < 61; ++ i){
if((q >> i) & 1){
++ tp;
x[tp] = 1;
y[tp] = i + 1;
}
}
++ tp;
x[tp] = nw+2;
y[tp] = tp;
}
printf("%d\n", tp);
for(int i = 1; i <= tp; ++ i){
printf("%d %d\n", x[i], y[i]);
}
}
return 0;
}
詳細信息
Pretests
Final Tests
Test #1:
score: 5
Acceptable Answer
time: 1ms
memory: 3932kb
input:
3 2 3 7
output:
2 1 1 1 2 5 1 1 1 2 1 1 1 2 4 5 7 1 1 1 2 1 3 1 1 1 2 1 3 5 7
result:
points 0.50 ok!
Test #2:
score: 4.88889
Acceptable Answer
time: 0ms
memory: 3932kb
input:
18 2 12 3 4 14 15 16 5 6 7 8 9 10 17 18 19 11 13
output:
2 1 1 1 2 7 1 1 1 2 1 3 1 4 1 3 1 4 6 7 5 1 1 1 2 1 1 1 2 4 5 3 1 1 1 2 1 3 8 1 1 1 2 1 3 1 4 1 2 1 3 1 4 6 8 9 1 1 1 2 1 3 1 4 1 1 1 2 1 3 1 4 6 9 5 1 1 1 2 1 3 1 4 1 5 6 1 1 1 2 1 3 1 1 1 3 5 6 6 1 1 1 2 1 3 1 2 1 3 5 6 7 1 1 1 2 1 3 1 1 1 2 1 3 5 7 4 1 1 1 2 1 3 1 4 7 1 1 1 2 1 3 1 4 1 1 1 4 6 7 ...
result:
points 0.48888888890 ok!
Test #3:
score: 4.62963
Acceptable Answer
time: 2ms
memory: 3792kb
input:
1000 5007 3003 9996 9736 3312 5329 2562 4090 6134 6150 6986 2898 7204 517 6654 2919 8349 9872 4599 2218 3173 3583 7299 6145 1844 4598 1006 8089 6612 9347 2184 7688 130 1755 2370 1092 7350 9767 8617 9190 6657 7364 9725 9721 9207 7689 4976 3581 3064 3576 1365 514 4607 1745 4618 1528 8188 9973 2244 818...
output:
22 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 1 1 2 1 3 1 4 1 8 1 9 1 10 1 13 15 22 22 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 1 1 2 1 4 1 5 1 6 1 8 1 9 1 10 1 12 14 22 21 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 3 1 4 1 9 1 10 1 11 1 14 16 21 19 1 1...
result:
points 0.4629629630 ok!
Test #4:
score: 4.60606
Acceptable Answer
time: 2ms
memory: 3792kb
input:
1000 98307 36116 14493 5016 61430 75953 12285 73730 85757 66729 61447 17476 43186 91500 24574 40950 24576 49147 96501 71173 46527 68765 69628 94212 45063 52957 81930 676 69312 69634 24579 99996 45047 62953 99994 99984 14179 90102 75032 21381 79722 4103 94201 67439 77831 63827 99744 8200 32760 65529 ...
output:
22 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 1 1 2 1 16 1 17 19 22 23 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 3 1 5 1 9 1 11 1 12 1 16 18 23 23 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 1 1 3 1 4 1 5 1 8 1 12 1...
result:
points 0.46060606060 ok!
Test #5:
score: 4.58974
Acceptable Answer
time: 3ms
memory: 3800kb
input:
1000 809111 950281 89262 179321 393208 24547 655362 65531 704027 999992 131069 884741 294912 626086 950264 950267 458747 884727 753671 696957 197950 983035 688124 189714 999990 753664 917500 822142 801218 163835 65532 950275 819195 458753 720898 557051 591732 884729 999991 281300 688129 139599 78642...
output:
31 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 1 1 2 1 3 1 5 1 8 1 12 1 13 1 15 1 19 1 20 22 31 27 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 1 1 4 1 16 1 18 1 19 1 20 22 27 28 1 1 1 2 1 3 1 4 1 5 1 6 ...
result:
points 0.4589743590 ok!
Test #6:
score: 4.55932
Acceptable Answer
time: 4ms
memory: 3744kb
input:
1000 369098742 905969674 479202334 100663290 838860792 944159797 985109111 649026517 719906661 33554431 637534202 999999979 570425349 821995535 268435455 973078526 936098446 467057727 805306378 704643081 771751930 633511073 997902848 125269879 738197507 859807671 138076525 715827882 738197498 369098...
output:
55 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 2 1 3 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 27 1 29 31 55 37 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 ...
result:
points 0.45593220340 ok!
Test #7:
score: 4.5443
Acceptable Answer
time: 5ms
memory: 3868kb
input:
1000 446676598780 893923292569 549755813880 68719476741 343597383684 446676598779 755914244101 273482235106 790273982456 581535539415 171798691848 721554505733 824633720834 68719476740 733007751850 522959032523 687194767370 412316860410 771943483615 515396075510 756223838451 115052727514 96207267430...
output:
75 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 2...
result:
points 0.45443037970 ok!
Test #8:
score: 0
Wrong Answer
time: 0ms
memory: 3932kb
input:
1000 252201579132747774 480910756701578053 216172782113783803 571743108865444174 384307168202282325 999999999999999988 999999931280523264 149274160422564448 760457199839655832 792633534417207288 468374361246531580 972777519512027128 12820183763356662 288230376151711744 180143985094819848 32425917317...
output:
115 48 1 49 2 50 3 51 4 52 5 53 6 54 7 55 8 57 9 58 10 115 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 2...
result:
wrong answer Integer parameter [name=l] equals to 48, violates the range [1, 2] (test case 1)
Test #9:
score: 0
Wrong Answer
time: 0ms
memory: 3856kb
input:
1000 576460752303423389 576460752303423101 220468472899108217 576460752303423230 576460752303423775 932568726839161535 576460752303423154 576460752303423572 576460752303423294 576460752303423852 576460752303423188 576460752303423244 668080091062916488 576460752303423716 576460752303423850 7533254593...
output:
116 49 1 50 2 51 3 52 4 53 5 54 6 55 7 56 8 57 9 58 10 59 11 116 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 ...
result:
wrong answer Integer parameter [name=l] equals to 49, violates the range [1, 2] (test case 1)
Test #10:
score: 0
Wrong Answer
time: 0ms
memory: 3840kb
input:
1000 300068858312824429 347534033336216452 156233453542995773 639780910120501035 906677527285507888 947271381216225336 475914711373713209 290094588714272061 739921099738438894 574120621511454511 381361632739163983 515622675216613715 162418173719281417 374063025867083477 974690524191532523 6210813787...
output:
88 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 1 1 3 1 4...
result:
wrong output format Unexpected end of file - int32 expected (test case 12)