QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#496704 | #2363. Dragon Balls | LingKer | AC ✓ | 9ms | 3732kb | C++17 | 2.0kb | 2024-07-28 15:02:16 | 2024-07-28 15:02:17 |
Judging History
answer
#pragma GCC optimize(2)
#pragma optimize(3, on)
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(), (c).end()
#define rall(x) (x).rbegin(), (x).rend()
#define Sum(a) accumulate((a).begin(), (a).end() , 0ll)
#define Min(a) *std::min_element((a).begin(), (a).end())
#define Max(a) *std::max_element((a).begin(), (a).end())
#define rev(a) reverse((a).begin(), (a).end())
#define each(x, a) for(auto& x : a)
#define mst(a, x) memset(a, x, sizeof(a))
#define LL long long
#define rep(i, from, to) for(ll i = from;i<to;i++)
#define rrep(i, from, to) for(ll i = from;i>to;i--)
#define to_uni(a) a.erase(unique(begin(a), end(a)), end(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pp pop_back
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
const int mod = 1e9 + 7;
const int P = 998244353;
const int INF = 0x3f3f3f3f;
const int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};
const int fx[8] = {-1, -1, 0, 1, 1, 1, 0, -1}, fy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
#define int long long
const int inf = 1e18;
void solve()
{
int n;
cin >> n;
auto ask = [&](int x , int y) {
cout << x << " " << y << endl;
int ans;
cin >> ans;
return ans;
};
while(n > 0)
{
int d = ask(0,0);
if(d == 0){
n --;
continue;
}
for(int x = 0 ;x <= 1000000 ; x ++)
{
int yy = d - x*x;
int ys = sqrt(yy);
if(0 <= ys && ys <= 1000000 && x*x+ys*ys == d) {
int b = ask(x,ys);
if(b == 0) {
n--;
break;
}
}
}
}
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
//cout.precision(10); cout.setf(ios::fixed);
int t = 1;
// cin >> t;
while(t--)
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3608kb
input:
2 115075346069 18281396898 0 144281198450 246975164928 207764925768 194974592500 161018080740 122288064416 83962656980 57712479380 31219978400 14038170660 4959853108 2790045000 0
output:
0 0 187255 282862 282862 187255 0 0 27443 378851 79733 371381 96911 367273 142835 351965 195871 325447 249265 286615 286615 249265 325447 195871 351965 142835 367273 96911 371381 79733 378851 27443
result:
ok Queries used 16
Test #2:
score: 0
Accepted
time: 9ms
memory: 3548kb
input:
7 67217950469 42228248498 41721486498 1812500 0 120757294269 91637069850 79167775698 0 643604679560 340297142245 294766521381 278348157061 251219727701 194171432845 152866209997 142299209357 125419348477 102067337341 57268301877 56393882773 57197373525 54998518941 52885648045 52665546077 53390297125...
output:
0 0 95663 240970 96913 240470 240470 96913 240970 95663 0 0 102987 331890 125205 324162 324162 125205 0 0 6674 802222 47438 800846 62978 799774 89818 797206 152314 787658 205082 775594 220102 771466 245902 763634 286798 749234 429482 677606 463366 654902 475994 645782 497426 629422 518458 612214 538...
result:
ok Queries used 47
Test #3:
score: 0
Accepted
time: 5ms
memory: 3608kb
input:
7 106609651105 0 192205367272 20778958624 0 263245533200 210330787490 196600340786 181242839090 179338981202 165199293890 150791264450 150729551330 152423466770 152970204914 158669676530 152733401920 124432682400 116638020864 91658588320 53132436640 40499312800 38865800480 31969918368 21059642656 50...
output:
0 0 19492 325929 0 0 113394 423494 244614 363826 0 0 25988 512416 48764 510752 78460 507040 82588 506384 118528 499196 189824 476668 221072 463004 237760 454660 241456 452708 267440 437860 328240 394340 358556 366992 366992 358556 394340 328240 437860 267440 452708 241456 454660 237760 463004 221072...
result:
ok Queries used 47
Test #4:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
1 450371040181 0
output:
0 0 144366 655385
result:
ok Queries used 2
Test #5:
score: 0
Accepted
time: 8ms
memory: 3636kb
input:
7 174257131880 54129153418 38233299850 23196165786 16450848 0 304433628074 72054630400 0 324546233029 145791280900 0 465190887465 306930070080 288739171530 230263701282 186076354986 45519490980 38170013130 17920652562 6819842826 2645948880 0 971341190210 388536476084 102222524168 0 1034707452928 426...
output:
0 0 61042 412954 102482 404666 160814 385222 293738 296606 296606 293738 0 0 29665 550957 286145 471757 0 0 18225 569398 373695 429998 0 0 32211 681288 50364 680187 111864 672813 162252 662469 367821 574368 383004 564357 432624 527283 471132 493179 493179 471132 527283 432624 0 0 295789 940133 57463...
result:
ok Queries used 47
Test #6:
score: 0
Accepted
time: 3ms
memory: 3612kb
input:
5 80741738512 14350915818 13177832634 1564425504 0 157345864360 874501434 940080986 1358625920 1279613440 0 158743303522 0 741388783525 34494635885 16597182025 6709428905 4376619725 6447189125 6555570265 16377856105 47218487845 94594686445 114059812850 92057722640 60098522500 59311102682 34218966330...
output:
0 0 9136 284004 48484 279984 279984 48484 284004 9136 0 0 83974 387678 85038 387446 107294 381882 108342 381586 142278 370274 0 0 55219 394581 0 0 62294 858783 122575 852270 180657 841874 214650 833855 271770 817025 272799 816682 328593 795874 413302 755361 490558 707631 538294 672033 565105 649650 ...
result:
ok Queries used 33
Test #7:
score: 0
Accepted
time: 5ms
memory: 3672kb
input:
7 118225786066 7880213097 1531327409 0 138801159601 27854075600 21354024554 16194267154 0 539523035428 63135508433 42015488912 0 757831112773 21726387218 19990369928 19192397578 22294269218 7446323909 5317821029 2686264549 0 788605627042 1761567368 0 847027589264 0 969862593025 1385810000 0
output:
0 0 121029 321835 213305 269679 269679 213305 0 0 53140 368751 74065 365124 92775 360824 208800 308551 0 0 113578 725688 195968 707898 383952 626182 0 0 24962 870177 34223 869862 184758 850703 201082 846993 276738 825377 292558 819903 353598 795487 406833 769622 0 0 612921 642599 642599 612921 0 0 3...
result:
ok Queries used 30
Test #8:
score: 0
Accepted
time: 7ms
memory: 3548kb
input:
7 167450188805 135369573138 114320319746 84064531986 66980075522 13892774720 7237877760 1091658560 0 458429522050 13739225021 32927726201 38555457397 9726991466 0 537331099156 9828963365 0 606524159597 10787950120 16033169242 18615473984 12932222474 519457338 0 629500207649 0 1119596136541 0 1425073...
output:
0 0 128383 388546 159311 376922 205951 353602 233807 335834 335834 233807 353602 205951 376922 159311 388546 128383 0 0 38249 675993 152559 659663 436195 517845 517845 436195 659663 152559 0 0 404580 611266 611266 404580 0 0 130141 767846 152554 763709 224786 745651 246509 738754 330979 704966 35146...
result:
ok Queries used 31
Test #9:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
4 7851264122 5643913504 1779987924 1207886788 1152960200 0 177882408985 0 429096042765 790831486224 735832493442 593776145664 528118206480 466957535706 343276834212 321528364560 300099602466 133340212980 118826596458 105236822250 46388761380 27046656234 12391066530 0 895625871850 1170021639200 71650...
output:
0 0 9079 88141 42281 77869 48811 73951 49489 73499 73499 49489 0 0 59493 417544 0 0 4611 655038 46818 653379 156771 636018 208083 621126 256194 602877 354573 550794 372051 539142 389334 526797 526797 389334 539142 372051 550794 354573 602877 256194 621126 208083 636018 156771 653379 46818 0 0 166715...
result:
ok Queries used 31
Test #10:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
1 635213397133 829671332 0
output:
0 0 179298 776573 207242 769587
result:
ok Queries used 3
Test #11:
score: 0
Accepted
time: 4ms
memory: 3692kb
input:
4 0 1000000000000 0 1000000000000 1000000000000 854080000000 520000000000 424000000000 238400000000 200000000000 177728000000 177728000000 200000000000 238400000000 128000000000 80000000000 5760000000 0 2000000000000 0
output:
0 0 0 0 0 1000000 0 0 0 1000000 75840 997120 280000 960000 352000 936000 537600 843200 600000 800000 658944 752192 752192 658944 800000 600000 843200 537600 936000 352000 960000 280000 997120 75840 1000000 0 0 0 1000000 1000000
result:
ok Queries used 20
Test #12:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
2 169 26 0 170 40 0
output:
0 0 0 13 5 12 0 0 1 13 7 11
result:
ok Queries used 6
Test #13:
score: 0
Accepted
time: 5ms
memory: 3548kb
input:
7 0 999998000001 0 999998000001 2 4157871104 108107351354 153845230772 176715326404 176715326404 153845230772 108107351354 4157871104 0 1000000000001 0 1000000000001 999996000004 960400040000 182481284672 178081315072 178081315072 182481284672 399960004 0 1999998000001 0 1999998000001 2 0
output:
0 0 0 0 0 999999 0 0 0 999999 64449 997920 324324 945945 384615 923076 663201 748440 748440 663201 923076 384615 945945 324324 997920 64449 999999 0 0 0 1 1000000 0 0 1 1000000 19999 999800 642335 766424 657535 753424 753424 657535 766424 642335 999800 19999 1000000 1 0 0 999999 1000000 0 0 999999 1...
result:
ok Queries used 30
Test #14:
score: 0
Accepted
time: 1ms
memory: 3732kb
input:
3 50 10 2 0 52 0 85 34 2 0
output:
0 0 1 7 5 5 7 1 0 0 4 6 0 0 2 9 6 7 7 6
result:
ok Queries used 10
Test #15:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
2 61 2 0 65 0
output:
0 0 5 6 6 5 0 0 1 8
result:
ok Queries used 5
Test #16:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
1 100 0
output:
0 0 0 10
result:
ok Queries used 2
Test #17:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
2 36 40 0 52 8 0
output:
0 0 0 6 6 0 0 0 4 6 6 4
result:
ok Queries used 6
Test #18:
score: 0
Accepted
time: 1ms
memory: 3544kb
input:
3 41 0 101 68 0 145 80 2 0
output:
0 0 4 5 0 0 1 10 10 1 0 0 1 12 8 9 9 8
result:
ok Queries used 9
Test #19:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
4 25 0 25 50 20 10 0 80 32 0 136 32 0
output:
0 0 0 5 0 0 0 5 3 4 4 3 5 0 0 0 4 8 8 4 0 0 6 10 10 6
result:
ok Queries used 13
Test #20:
score: 0
Accepted
time: 6ms
memory: 3620kb
input:
7 428518727937 25272811600 2917410498 0 620479113817 31247675684 20987310050 4422541568 0 930331889705 99797676921 48845653525 12651537610 0 1159657788185 21252533705 8922914185 2508409737 10985014097 33970976593 6738055168 0 1180540465777 10382176465 10307619197 153914 0 1253012626256 0 12697109452...
output:
0 0 250239 604896 443391 481584 481584 443391 0 0 36389 786864 68384 784731 146171 774024 210939 758936 0 0 251141 931268 357848 895699 895699 357848 931268 251141 0 0 419077 991984 469693 969044 542141 930452 650363 858304 713851 806272 806272 713851 858304 650363 0 0 462329 983256 462684 983089 98...
result:
ok Queries used 31
Test #21:
score: 0
Accepted
time: 3ms
memory: 3632kb
input:
7 157163452745 6066030490 5631895874 5439446480 5176808676 5152900090 4674898496 4126343938 4105866690 3997798480 3294362340 2666288466 2355454244 2329193290 2247862500 2167771762 1575152980 1422293690 1400033232 1210645540 943903818 831617514 637510394 528648082 490226256 478268290 202806090 168691...
output:
0 0 1076 396437 3928 396419 5227 396404 7037 396376 7204 396373 10627 396296 14776 396163 14936 396157 15787 396124 21629 395848 27392 395491 30493 395264 30764 395243 31613 395176 32464 395107 39317 394484 41284 394283 41579 394252 44189 393968 48236 393493 50108 393259 53668 392789 55904 392477 56...
result:
ok Queries used 549
Test #22:
score: 0
Accepted
time: 9ms
memory: 3616kb
input:
7 101206452745 80965162196 10477439282 0 474046452745 78319814884 61730991824 51351314690 43768286890 54564352322 68463681642 101333418290 127682746090 119450150480 91980010980 54628274516 36361593856 1897020500 0 772156452745 72884946290 605668562 256462544 88544375636 41919100898 0 794224452745 73...
output:
0 0 6261 318068 185832 258211 258211 185832 0 0 63552 685571 106772 680181 143491 673392 185781 662972 322691 608208 360501 586588 418909 546408 452619 518828 518828 452619 546408 418909 586588 360501 608208 322691 662972 185781 673392 143491 0 0 29411 878232 272611 835368 283132 831861 550468 68493...
result:
ok Queries used 55
Test #23:
score: 0
Accepted
time: 5ms
memory: 3568kb
input:
5 273194767090 27977358500 14001123780 11316895744 5600038500 1002549604 212152360 0 610704825700 0 835386119714 0 1183262691010 26586780993 21833136845 20975706205 6787917709 44727072469 51538339865 4784162816 9004820 0 1273157445325 0
output:
0 0 7469 522627 56763 519589 68691 518147 99939 513037 141981 503027 158361 498113 172179 493507 0 0 66024 778682 0 0 542183 735815 0 0 471121 980463 485127 973609 487811 972267 546023 940809 763643 774669 774669 763643 940809 546023 972267 487811 973609 485127 0 0 628333 937206
result:
ok Queries used 24
Test #24:
score: 0
Accepted
time: 6ms
memory: 3612kb
input:
7 26903541044 40725438408 31138325576 27621932328 12568077568 10255799176 1845536400 961123328 0 509463025117 0 711493226050 37908587349 26751605257 24345555317 9099491733 7991626409 59045000 0 790956991333 17265091216 0 848258117737 29508262793 16497198089 0 914866428820 93341365504 70590962000 531...
output:
0 0 20090 162788 50362 156100 61670 151988 111860 119962 119962 111860 151988 61670 156100 50362 162788 20090 0 0 27051 713254 0 0 64681 841017 96077 838011 103707 837101 166795 826845 173391 825487 326877 777589 333947 774579 0 0 130958 879663 259138 850767 0 0 378636 839579 418236 820571 820571 41...
result:
ok Queries used 36
Test #25:
score: 0
Accepted
time: 8ms
memory: 3668kb
input:
7 420094974505 151161112021 18097981065 62502363445 0 608833673482 3285124 0 780235036634 95615207936 0 795994910162 94017357061 29344044085 30778538405 58502611141 0 1122954332921 0 1402089078538 0 1597066903210 31162431492 10333704420 5717654048 0
output:
0 0 664 648147 388357 518916 518916 388357 648147 664 0 0 443531 641961 445021 640929 0 0 54065 881653 354625 808997 0 0 112541 885059 370499 811619 384059 805291 482251 750619 750619 482251 0 0 404236 979565 0 0 636767 998307 0 0 790227 986209 847323 937609 866473 919941 919941 866473
result:
ok Queries used 26
Test #26:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
3 9061 0 15688 1696 0 19216 32 0
output:
0 0 6 95 0 0 42 118 78 98 0 0 96 100 100 96
result:
ok Queries used 8
Test #27:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
1 0
output:
0 0
result:
ok Queries used 1
Test #28:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
4 0 1 0 1 1 0 2 0
output:
0 0 0 0 0 1 0 0 0 1 1 0 0 0 1 1
result:
ok Queries used 8
Test #29:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
7 0 1 0 1 2 0 4 1 0 5 0 5 1 0 8 0
output:
0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 2 2 0 0 0 1 2 0 0 1 2 2 1 0 0 2 2
result:
ok Queries used 16
Test #30:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
7 16 5 0 37 0 52 0 80 4 0 101 9 0 116 0 125 100 50 0
output:
0 0 0 4 4 0 0 0 1 6 0 0 4 6 0 0 4 8 8 4 0 0 1 10 10 1 0 0 4 10 0 0 2 11 5 10 10 5
result:
ok Queries used 19
Test #31:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
2 25 20 2 0 34 8 0
output:
0 0 0 5 3 4 4 3 0 0 3 5 5 3
result:
ok Queries used 7
Test #32:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
4 1 0 10 0 29 1 0 34 0
output:
0 0 0 1 0 0 1 3 0 0 2 5 5 2 0 0 3 5
result:
ok Queries used 9
Test #33:
score: 0
Accepted
time: 1ms
memory: 3544kb
input:
7 5506 0 5620 1825 0 9346 0 10625 2500 850 180 0 11090 4201 2677 0 11713 9826 3536 2450 1802 52 0 13282 7328 3200 0
output:
0 0 45 59 0 0 12 74 52 54 0 0 61 75 0 0 4 103 25 100 40 95 52 89 0 0 41 97 53 91 91 53 0 0 7 108 48 97 57 92 63 88 88 63 92 57 0 0 31 111 59 99 99 59
result:
ok Queries used 27
Test #34:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
7 34121 0 75706 141512 0 560242 0 686930 0 832768 0 910564 59648 0 1133289 0
output:
0 0 85 164 0 0 9 275 275 9 0 0 201 721 0 0 241 793 0 0 32 912 0 0 392 870 600 742 0 0 708 795
result:
ok Queries used 16
Test #35:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
7 4118481 0 6920244 0 40831754 27400 0 44380981 6201698 0 48274265 4597337 2970724 1004692 0 82645568 0 100298756 72125000 59754312 0
output:
0 0 1116 1695 0 0 1050 2412 0 0 2627 5825 2777 5755 0 0 1934 6375 4391 5010 0 0 116 6947 2779 6368 3427 6044 4261 5488 0 0 232 9088 0 0 3016 9550 3800 9266 9266 3800
result:
ok Queries used 21
Test #36:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
7 1551882757 20072002 118273552 122483402 682101914 534882564 56310800 53419050 0 1850793893 3040596 32266 0 2730596392 0 3286783988 3643637477 1367685185 233634965 0 5033680137 1268746196 779693906 126031050 0 9215153225 4264498450 3686061290 3486002900 2959355620 1529907264 1063614682 901971450 63...
output:
0 0 5871 38954 12966 37199 13151 37134 26721 28946 28946 26721 37134 13151 37199 12966 38954 5871 0 0 1942 42977 3503 42878 3682 42863 0 0 5014 52014 0 0 7468 56842 30788 48362 48362 30788 56842 7468 0 0 31371 63636 41016 57891 57891 41016 63636 31371 0 0 6904 95747 11740 95275 13483 95044 18275 942...
result:
ok Queries used 45
Test #37:
score: 0
Accepted
time: 5ms
memory: 3572kb
input:
4 606657143573 93331868242 40024833876 11102675776 0 843939159977 13135239844 97245458 0 954714843601 0 1753444730825 15991515122 0
output:
0 0 295898 720487 391673 673238 470807 620482 550247 551258 0 0 567539 722384 646096 653069 653069 646096 0 0 85524 973345 0 0 890557 979976 979976 890557
result:
ok Queries used 14
Test #38:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
7 11881 0 1092416 77776 5776 6625 6404 0 1144400 7840 0 1227529 53018 0 1248004 169 26869 25261 0 1261121 0 1606841 97682 0
output:
0 0 0 109 0 0 104 1040 304 1000 496 920 920 496 1000 304 0 0 296 1028 380 1000 0 0 260 1077 477 1000 0 0 498 1000 648 910 910 648 1000 498 0 0 511 1000 0 0 779 1000 1000 779
result:
ok Queries used 24
Test #39:
score: 0
Accepted
time: 9ms
memory: 3668kb
input:
7 91441526449 0 104633487841 209266975682 0 419304166369 310094620769 199017873889 239957423969 176420160576 45330180148 0 1019137125569 85721885089 56564318369 6334450849 7927344596 3123515728 0 1185864454400 0 1201600102001 303673420026 198768731476 130376777636 99355813666 98533422676 58614639122...
output:
0 0 0 302393 0 0 0 323471 323471 0 0 0 0 647537 210012 612535 397320 511313 511313 397320 612535 210012 647537 0 0 0 138337 1000000 193465 990812 395513 928820 928820 395513 990812 193465 1000000 138337 0 0 431120 1000000 0 0 448999 1000000 556676 944305 657560 877049 750385 799076 799076 750385 877...
result:
ok Queries used 33
Test #40:
score: 0
Accepted
time: 7ms
memory: 3556kb
input:
7 396792907225 0 649478033604 0 1015053081481 0 1223792386489 36109500625 0 1396932760676 1093360356 0 1439691000464 0 1604453381156 0
output:
0 0 0 629915 0 0 0 805902 0 0 122691 1000000 0 0 473067 1000000 1000000 473067 0 0 630026 1000000 1000000 630026 0 0 663092 1000000 0 0 777466 1000000
result:
ok Queries used 16
Test #41:
score: 0
Accepted
time: 7ms
memory: 3632kb
input:
7 43483926784 0 68571183321 137142366642 86726792034 9602966592 0 250454206116 287080231285 0 648145755625 75529780794 52591004240 167605222889 259258302250 51851660450 0 1000882208804 26907481225 46101922596 181695946788 0 1037534025169 0 1469652537344 0
output:
0 0 0 208528 0 0 0 261861 96264 243525 243525 96264 261861 0 0 0 0 500454 500454 0 0 0 0 805075 225421 772872 483045 644060 644060 483045 772872 225421 805075 0 0 0 29702 1000000 591448 806890 806890 591448 1000000 29702 0 0 193737 1000000 0 0 685312 1000000
result:
ok Queries used 26