QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#357660 | #8132. Freshman's Dream | solar# | WA | 64ms | 3572kb | C++17 | 402b | 2024-03-19 07:21:27 | 2024-03-19 07:21:28 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
ll n;
cin >> n;
if (n & 1) {
cout << -1 << endl;
return;
}
ll x = n / 2, cnt = 0;
while (x > 0) {
x >>= 1;
cnt++;
}
ll a = 1 << cnt;
a -= 1;
ll b = (2 * a - n) / 2 + 1;
cout << a << " " << b << endl;
}
signed main() {
ll t;
cin >> t;
while (t--) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3568kb
input:
5 2 3 6 10 18
output:
1 1 -1 3 1 7 3 15 7
result:
ok ok
Test #2:
score: 0
Accepted
time: 48ms
memory: 3572kb
input:
100000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...
output:
1 1 -1 3 2 -1 3 1 -1 7 4 -1 7 3 -1 7 2 -1 7 1 -1 15 8 -1 15 7 -1 15 6 -1 15 5 -1 15 4 -1 15 3 -1 15 2 -1 15 1 -1 31 16 -1 31 15 -1 31 14 -1 31 13 -1 31 12 -1 31 11 -1 31 10 -1 31 9 -1 31 8 -1 31 7 -1 31 6 -1 31 5 -1 31 4 -1 31 3 -1 31 2 -1 31 1 -1 63 32 -1 63 31 -1 63 30 -1 63 29 -1 63 28 -1 63 27 -...
result:
ok ok
Test #3:
score: 0
Accepted
time: 27ms
memory: 3548kb
input:
100000 76316 55087 1035148 480523 322879 607749 440658 434700 941531 657517 247448 953385 569641 592597 188131 769378 397552 94739 487375 142576 407344 532339 798526 521099 294428 414998 415977 646853 941103 21816 299379 1029240 171218 784108 711027 121363 223925 197035 899124 613355 178257 213375 3...
output:
65535 27378 -1 524287 6714 -1 -1 -1 262143 41815 262143 44794 -1 -1 131071 7348 -1 -1 -1 -1 524287 139599 262143 63368 -1 -1 131071 59784 262143 58472 -1 524287 125025 -1 262143 114930 262143 54645 -1 -1 -1 16383 5476 -1 524287 9668 131071 45463 524287 132234 -1 -1 -1 -1 524287 74726 -1 -1 -1 262143...
result:
ok ok
Test #4:
score: -100
Wrong Answer
time: 64ms
memory: 3512kb
input:
100000 279938093875 699023415517 1048269983590 537007992988 908117019805 683806387338 334400705624 484515916103 888494261285 220468538805 253319179778 357268673752 644637898889 919322454545 854350801341 1022830170092 486578580191 750669735889 4206967959 937169662800 852140555915 924210466276 2534095...
output:
-1 -1 127 -524134991667 63 -268503996430 -1 127 -341903193541 63 -167200352748 -1 -1 -1 31 -126659589857 63 -178634336812 -1 -1 -1 127 -511415084918 -1 -1 -1 127 -468584831272 -1 127 -462105233010 31 -126704791267 127 -416552858533 -1 -1 63 -147643868832 127 -346300482239 127 -358814070042 -1 127 -3...
result:
wrong answer Integer parameter [name=b] equals to -524134991667, violates the range [1, 1152921504606846975]