QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#381449 | #6677. Puzzle: Sashigane | SSHL# | AC ✓ | 1ms | 3900kb | C++14 | 1.7kb | 2024-04-07 17:56:23 | 2024-04-07 17:56:24 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
void solve()
{
int n,a,b;
cin>>n>>a>>b;
// cout<<"Yes\n";
vector<int> ans;
int d=min(a-1,n-b);
int r=a-d,w=b+d;
int h=w-r;
bool f=1;
for(;r<=n&&w>=1;r++,w--)
{
if(a==r&&b==w)
{
f=1-f;
h=1;
continue;
}
if(f)
{
ans.push_back(r);
ans.push_back(w);
ans.push_back(h);
ans.push_back(-h);
h--;
}else{
ans.push_back(r);
ans.push_back(w);
ans.push_back(-h);
ans.push_back(h);
h++;
}
}
if(!(r==n+1&&w==0))
{
if(r==n+1)
{
r=a-d-1;
f=1;
}
if(w==0)
{
w=b+d+1;
f=0;
}
h=b+d-a+d+1;
}
if(f)
{
for(;r>0&&w>0;r--,w--)
{
ans.push_back(r);
ans.push_back(w);
ans.push_back(h);
ans.push_back(h);
h++;
}
}else{
for(;r<=n&&w<=n;r++,w++)
{
ans.push_back(r);
ans.push_back(w);
ans.push_back(-h);
ans.push_back(-h);
h++;
}
}
int p=ans.size()/4;
if(p>((n*n-1)/3))
cout<<"No\n";
else{
cout<<"Yes\n";
cout<<p<<'\n';
for(int i=0;i<(int)ans.size();i+=4)
{
cout<<ans[i]<<' '<<ans[i+1]<<' '<<ans[i+2]<<' '<<ans[i+3]<<'\n';
}
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t=1;
// cin>>t;
while(t--)
solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3620kb
input:
5 3 4
output:
Yes 4 2 5 3 -3 4 3 -1 1 5 2 -2 2 1 1 4 4
result:
ok Correct. (1 test case)
Test #2:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
1 1 1
output:
Yes 0
result:
ok Correct. (1 test case)
Test #3:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
3 2 3
output:
Yes 2 3 2 -1 1 1 1 2 2
result:
ok Correct. (1 test case)
Test #4:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
10 10 5
output:
Yes 9 5 10 5 -5 6 9 4 -4 7 8 3 -3 8 7 2 -2 9 6 1 -1 4 4 6 6 3 3 7 7 2 2 8 8 1 1 9 9
result:
ok Correct. (1 test case)
Test #5:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
10 5 7
output:
Yes 9 2 10 8 -8 3 9 7 -7 4 8 6 -6 6 6 -1 1 7 5 -2 2 8 4 -3 3 9 3 -4 4 10 2 -5 5 1 1 9 9
result:
ok Correct. (1 test case)
Test #6:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
10 9 2
output:
Yes 9 1 10 9 -9 2 9 8 -8 3 8 7 -7 4 7 6 -6 5 6 5 -5 6 5 4 -4 7 4 3 -3 8 3 2 -2 10 1 -1 1
result:
ok Correct. (1 test case)
Test #7:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
10 6 10
output:
Yes 9 7 9 -1 1 8 8 -2 2 9 7 -3 3 10 6 -4 4 5 5 5 5 4 4 6 6 3 3 7 7 2 2 8 8 1 1 9 9
result:
ok Correct. (1 test case)
Test #8:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
10 8 4
output:
Yes 9 2 10 8 -8 3 9 7 -7 4 8 6 -6 5 7 5 -5 6 6 4 -4 7 5 3 -3 9 3 -1 1 10 2 -2 2 1 1 9 9
result:
ok Correct. (1 test case)
Test #9:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
999 396 693
output:
Yes 998 90 999 909 -909 91 998 908 -908 92 997 907 -907 93 996 906 -906 94 995 905 -905 95 994 904 -904 96 993 903 -903 97 992 902 -902 98 991 901 -901 99 990 900 -900 100 989 899 -899 101 988 898 -898 102 987 897 -897 103 986 896 -896 104 985 895 -895 105 984 894 -894 106 983 893 -893 107 982 892 -...
result:
ok Correct. (1 test case)
Test #10:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
999 963 827
output:
Yes 998 791 999 208 -208 792 998 207 -207 793 997 206 -206 794 996 205 -205 795 995 204 -204 796 994 203 -203 797 993 202 -202 798 992 201 -201 799 991 200 -200 800 990 199 -199 801 989 198 -198 802 988 197 -197 803 987 196 -196 804 986 195 -195 805 985 194 -194 806 984 193 -193 807 983 192 -192 808...
result:
ok Correct. (1 test case)
Test #11:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
999 871 185
output:
Yes 998 57 999 942 -942 58 998 941 -941 59 997 940 -940 60 996 939 -939 61 995 938 -938 62 994 937 -937 63 993 936 -936 64 992 935 -935 65 991 934 -934 66 990 933 -933 67 989 932 -932 68 988 931 -931 69 987 930 -930 70 986 929 -929 71 985 928 -928 72 984 927 -927 73 983 926 -926 74 982 925 -925 75 9...
result:
ok Correct. (1 test case)
Test #12:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
999 787 812
output:
Yes 998 600 999 399 -399 601 998 398 -398 602 997 397 -397 603 996 396 -396 604 995 395 -395 605 994 394 -394 606 993 393 -393 607 992 392 -392 608 991 391 -391 609 990 390 -390 610 989 389 -389 611 988 388 -388 612 987 387 -387 613 986 386 -386 614 985 385 -385 615 984 384 -384 616 983 383 -383 617...
result:
ok Correct. (1 test case)
Test #13:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
999 396 199
output:
Yes 998 1 594 593 -593 2 593 592 -592 3 592 591 -591 4 591 590 -590 5 590 589 -589 6 589 588 -588 7 588 587 -587 8 587 586 -586 9 586 585 -585 10 585 584 -584 11 584 583 -583 12 583 582 -582 13 582 581 -581 14 581 580 -580 15 580 579 -579 16 579 578 -578 17 578 577 -577 18 577 576 -576 19 576 575 -5...
result:
ok Correct. (1 test case)
Test #14:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
999 1 1
output:
Yes 998 2 2 -1 -1 3 3 -2 -2 4 4 -3 -3 5 5 -4 -4 6 6 -5 -5 7 7 -6 -6 8 8 -7 -7 9 9 -8 -8 10 10 -9 -9 11 11 -10 -10 12 12 -11 -11 13 13 -12 -12 14 14 -13 -13 15 15 -14 -14 16 16 -15 -15 17 17 -16 -16 18 18 -17 -17 19 19 -18 -18 20 20 -19 -19 21 21 -20 -20 22 22 -21 -21 23 23 -22 -22 24 24 -23 -23 25 2...
result:
ok Correct. (1 test case)
Test #15:
score: 0
Accepted
time: 1ms
memory: 3860kb
input:
999 163 1
output:
Yes 998 1 163 162 -162 2 162 161 -161 3 161 160 -160 4 160 159 -159 5 159 158 -158 6 158 157 -157 7 157 156 -156 8 156 155 -155 9 155 154 -154 10 154 153 -153 11 153 152 -152 12 152 151 -151 13 151 150 -150 14 150 149 -149 15 149 148 -148 16 148 147 -147 17 147 146 -146 18 146 145 -145 19 145 144 -1...
result:
ok Correct. (1 test case)
Test #16:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
999 999 1
output:
Yes 998 1 999 998 -998 2 998 997 -997 3 997 996 -996 4 996 995 -995 5 995 994 -994 6 994 993 -993 7 993 992 -992 8 992 991 -991 9 991 990 -990 10 990 989 -989 11 989 988 -988 12 988 987 -987 13 987 986 -986 14 986 985 -985 15 985 984 -984 16 984 983 -983 17 983 982 -982 18 982 981 -981 19 981 980 -9...
result:
ok Correct. (1 test case)
Test #17:
score: 0
Accepted
time: 1ms
memory: 3604kb
input:
999 1 969
output:
Yes 998 2 968 -1 1 3 967 -2 2 4 966 -3 3 5 965 -4 4 6 964 -5 5 7 963 -6 6 8 962 -7 7 9 961 -8 8 10 960 -9 9 11 959 -10 10 12 958 -11 11 13 957 -12 12 14 956 -13 13 15 955 -14 14 16 954 -15 15 17 953 -16 16 18 952 -17 17 19 951 -18 18 20 950 -19 19 21 949 -20 20 22 948 -21 21 23 947 -22 22 24 946 -23...
result:
ok Correct. (1 test case)
Test #18:
score: 0
Accepted
time: 1ms
memory: 3696kb
input:
999 999 780
output:
Yes 998 780 999 219 -219 781 998 218 -218 782 997 217 -217 783 996 216 -216 784 995 215 -215 785 994 214 -214 786 993 213 -213 787 992 212 -212 788 991 211 -211 789 990 210 -210 790 989 209 -209 791 988 208 -208 792 987 207 -207 793 986 206 -206 794 985 205 -205 795 984 204 -204 796 983 203 -203 797...
result:
ok Correct. (1 test case)
Test #19:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
999 1 999
output:
Yes 998 2 998 -1 1 3 997 -2 2 4 996 -3 3 5 995 -4 4 6 994 -5 5 7 993 -6 6 8 992 -7 7 9 991 -8 8 10 990 -9 9 11 989 -10 10 12 988 -11 11 13 987 -12 12 14 986 -13 13 15 985 -14 14 16 984 -15 15 17 983 -16 16 18 982 -17 17 19 981 -18 18 20 980 -19 19 21 979 -20 20 22 978 -21 21 23 977 -22 22 24 976 -23...
result:
ok Correct. (1 test case)
Test #20:
score: 0
Accepted
time: 1ms
memory: 3604kb
input:
999 686 999
output:
Yes 998 687 998 -1 1 688 997 -2 2 689 996 -3 3 690 995 -4 4 691 994 -5 5 692 993 -6 6 693 992 -7 7 694 991 -8 8 695 990 -9 9 696 989 -10 10 697 988 -11 11 698 987 -12 12 699 986 -13 13 700 985 -14 14 701 984 -15 15 702 983 -16 16 703 982 -17 17 704 981 -18 18 705 980 -19 19 706 979 -20 20 707 978 -2...
result:
ok Correct. (1 test case)
Test #21:
score: 0
Accepted
time: 1ms
memory: 3856kb
input:
999 999 999
output:
Yes 998 998 998 1 1 997 997 2 2 996 996 3 3 995 995 4 4 994 994 5 5 993 993 6 6 992 992 7 7 991 991 8 8 990 990 9 9 989 989 10 10 988 988 11 11 987 987 12 12 986 986 13 13 985 985 14 14 984 984 15 15 983 983 16 16 982 982 17 17 981 981 18 18 980 980 19 19 979 979 20 20 978 978 21 21 977 977 22 22 97...
result:
ok Correct. (1 test case)
Test #22:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
1000 757 728
output:
Yes 999 485 1000 515 -515 486 999 514 -514 487 998 513 -513 488 997 512 -512 489 996 511 -511 490 995 510 -510 491 994 509 -509 492 993 508 -508 493 992 507 -507 494 991 506 -506 495 990 505 -505 496 989 504 -504 497 988 503 -503 498 987 502 -502 499 986 501 -501 500 985 500 -500 501 984 499 -499 50...
result:
ok Correct. (1 test case)
Test #23:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
1000 132 993
output:
Yes 999 125 1000 875 -875 126 999 874 -874 127 998 873 -873 128 997 872 -872 129 996 871 -871 130 995 870 -870 131 994 869 -869 133 992 -1 1 134 991 -2 2 135 990 -3 3 136 989 -4 4 137 988 -5 5 138 987 -6 6 139 986 -7 7 140 985 -8 8 141 984 -9 9 142 983 -10 10 143 982 -11 11 144 981 -12 12 145 980 -1...
result:
ok Correct. (1 test case)
Test #24:
score: 0
Accepted
time: 1ms
memory: 3544kb
input:
1000 703 499
output:
Yes 999 202 1000 798 -798 203 999 797 -797 204 998 796 -796 205 997 795 -795 206 996 794 -794 207 995 793 -793 208 994 792 -792 209 993 791 -791 210 992 790 -790 211 991 789 -789 212 990 788 -788 213 989 787 -787 214 988 786 -786 215 987 785 -785 216 986 784 -784 217 985 783 -783 218 984 782 -782 21...
result:
ok Correct. (1 test case)
Test #25:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
1000 910 298
output:
Yes 999 208 1000 792 -792 209 999 791 -791 210 998 790 -790 211 997 789 -789 212 996 788 -788 213 995 787 -787 214 994 786 -786 215 993 785 -785 216 992 784 -784 217 991 783 -783 218 990 782 -782 219 989 781 -781 220 988 780 -780 221 987 779 -779 222 986 778 -778 223 985 777 -777 224 984 776 -776 22...
result:
ok Correct. (1 test case)
Test #26:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
1000 171 322
output:
Yes 999 1 492 491 -491 2 491 490 -490 3 490 489 -489 4 489 488 -488 5 488 487 -487 6 487 486 -486 7 486 485 -485 8 485 484 -484 9 484 483 -483 10 483 482 -482 11 482 481 -481 12 481 480 -480 13 480 479 -479 14 479 478 -478 15 478 477 -477 16 477 476 -476 17 476 475 -475 18 475 474 -474 19 474 473 -4...
result:
ok Correct. (1 test case)
Test #27:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
1000 1 1
output:
Yes 999 2 2 -1 -1 3 3 -2 -2 4 4 -3 -3 5 5 -4 -4 6 6 -5 -5 7 7 -6 -6 8 8 -7 -7 9 9 -8 -8 10 10 -9 -9 11 11 -10 -10 12 12 -11 -11 13 13 -12 -12 14 14 -13 -13 15 15 -14 -14 16 16 -15 -15 17 17 -16 -16 18 18 -17 -17 19 19 -18 -18 20 20 -19 -19 21 21 -20 -20 22 22 -21 -21 23 23 -22 -22 24 24 -23 -23 25 2...
result:
ok Correct. (1 test case)
Test #28:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
1000 480 1
output:
Yes 999 1 480 479 -479 2 479 478 -478 3 478 477 -477 4 477 476 -476 5 476 475 -475 6 475 474 -474 7 474 473 -473 8 473 472 -472 9 472 471 -471 10 471 470 -470 11 470 469 -469 12 469 468 -468 13 468 467 -467 14 467 466 -466 15 466 465 -465 16 465 464 -464 17 464 463 -463 18 463 462 -462 19 462 461 -4...
result:
ok Correct. (1 test case)
Test #29:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
1000 1000 1
output:
Yes 999 1 1000 999 -999 2 999 998 -998 3 998 997 -997 4 997 996 -996 5 996 995 -995 6 995 994 -994 7 994 993 -993 8 993 992 -992 9 992 991 -991 10 991 990 -990 11 990 989 -989 12 989 988 -988 13 988 987 -987 14 987 986 -986 15 986 985 -985 16 985 984 -984 17 984 983 -983 18 983 982 -982 19 982 981 -...
result:
ok Correct. (1 test case)
Test #30:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
1000 1 339
output:
Yes 999 2 338 -1 1 3 337 -2 2 4 336 -3 3 5 335 -4 4 6 334 -5 5 7 333 -6 6 8 332 -7 7 9 331 -8 8 10 330 -9 9 11 329 -10 10 12 328 -11 11 13 327 -12 12 14 326 -13 13 15 325 -14 14 16 324 -15 15 17 323 -16 16 18 322 -17 17 19 321 -18 18 20 320 -19 19 21 319 -20 20 22 318 -21 21 23 317 -22 22 24 316 -23...
result:
ok Correct. (1 test case)
Test #31:
score: 0
Accepted
time: 1ms
memory: 3896kb
input:
1000 1000 161
output:
Yes 999 161 1000 839 -839 162 999 838 -838 163 998 837 -837 164 997 836 -836 165 996 835 -835 166 995 834 -834 167 994 833 -833 168 993 832 -832 169 992 831 -831 170 991 830 -830 171 990 829 -829 172 989 828 -828 173 988 827 -827 174 987 826 -826 175 986 825 -825 176 985 824 -824 177 984 823 -823 17...
result:
ok Correct. (1 test case)
Test #32:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
1000 1 1000
output:
Yes 999 2 999 -1 1 3 998 -2 2 4 997 -3 3 5 996 -4 4 6 995 -5 5 7 994 -6 6 8 993 -7 7 9 992 -8 8 10 991 -9 9 11 990 -10 10 12 989 -11 11 13 988 -12 12 14 987 -13 13 15 986 -14 14 16 985 -15 15 17 984 -16 16 18 983 -17 17 19 982 -18 18 20 981 -19 19 21 980 -20 20 22 979 -21 21 23 978 -22 22 24 977 -23...
result:
ok Correct. (1 test case)
Test #33:
score: 0
Accepted
time: 1ms
memory: 3896kb
input:
1000 759 1000
output:
Yes 999 760 999 -1 1 761 998 -2 2 762 997 -3 3 763 996 -4 4 764 995 -5 5 765 994 -6 6 766 993 -7 7 767 992 -8 8 768 991 -9 9 769 990 -10 10 770 989 -11 11 771 988 -12 12 772 987 -13 13 773 986 -14 14 774 985 -15 15 775 984 -16 16 776 983 -17 17 777 982 -18 18 778 981 -19 19 779 980 -20 20 780 979 -2...
result:
ok Correct. (1 test case)
Test #34:
score: 0
Accepted
time: 1ms
memory: 3900kb
input:
1000 1000 1000
output:
Yes 999 999 999 1 1 998 998 2 2 997 997 3 3 996 996 4 4 995 995 5 5 994 994 6 6 993 993 7 7 992 992 8 8 991 991 9 9 990 990 10 10 989 989 11 11 988 988 12 12 987 987 13 13 986 986 14 14 985 985 15 15 984 984 16 16 983 983 17 17 982 982 18 18 981 981 19 19 980 980 20 20 979 979 21 21 978 978 22 22 97...
result:
ok Correct. (1 test case)
Test #35:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
2 1 1
output:
Yes 1 2 2 -1 -1
result:
ok Correct. (1 test case)
Test #36:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
2 1 2
output:
Yes 1 2 1 -1 1
result:
ok Correct. (1 test case)
Test #37:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
2 2 1
output:
Yes 1 1 2 1 -1
result:
ok Correct. (1 test case)
Test #38:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
2 2 2
output:
Yes 1 1 1 1 1
result:
ok Correct. (1 test case)
Test #39:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
810 114 514
output:
Yes 809 1 627 626 -626 2 626 625 -625 3 625 624 -624 4 624 623 -623 5 623 622 -622 6 622 621 -621 7 621 620 -620 8 620 619 -619 9 619 618 -618 10 618 617 -617 11 617 616 -616 12 616 615 -615 13 615 614 -614 14 614 613 -613 15 613 612 -612 16 612 611 -611 17 611 610 -610 18 610 609 -609 19 609 608 -6...
result:
ok Correct. (1 test case)
Test #40:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
810 514 114
output:
Yes 809 1 627 626 -626 2 626 625 -625 3 625 624 -624 4 624 623 -623 5 623 622 -622 6 622 621 -621 7 621 620 -620 8 620 619 -619 9 619 618 -618 10 618 617 -617 11 617 616 -616 12 616 615 -615 13 615 614 -614 14 614 613 -613 15 613 612 -612 16 612 611 -611 17 611 610 -610 18 610 609 -609 19 609 608 -6...
result:
ok Correct. (1 test case)