QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#121362 | #6677. Puzzle: Sashigane | SingleZombie | AC ✓ | 1ms | 3836kb | C++14 | 1.8kb | 2023-07-08 00:14:16 | 2023-07-08 00:14:18 |
Judging History
answer
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <map>
#include <set>
#include <bitset>
#include <ctime>
#include <cassert>
#include <complex>
const int INF = 0x3f3f3f3f;
const long long INFLL = 0x3f3f3f3f3f3f3f3fll;
#define memset0(x) memset(x, 0, sizeof(x))
#define memsetM1(x) memset(x, -1, sizeof(x))
#define memsetINF(x) memset(x, INF, sizeof(x))
using namespace std;
int n, bi, bj;
vector<tuple<int, int, int, int>> anss;
void solve(int n, int ii, int jj, int di, int dj)
{
if (n == 1)
{
return;
}
if (max(ii, jj) < n)
{
for (int i = max(ii, jj) + 1; i <= n; i++)
{
anss.push_back({ i + di, i + dj, -(i - 1), -(i - 1) });
}
solve(max(ii, jj), ii, jj, di, dj);
return;
}
if (ii == 1)
{
for (int i = 1; i < n; i++)
{
anss.push_back({ n + 1 - i + di, i + di, -(n - i), (n - i) });
}
}
else if (jj == 1)
{
for (int i = 1; i < n; i++)
{
anss.push_back({ i + di, n + 1 - i + di, (n - i), -(n - i) });
}
}
else
{
for (int i = 1; i <= min(ii, jj) - 1; i++)
{
anss.push_back({ i + di, i + dj, (n - i), (n - i) });
}
int tmp = min(ii, jj) - 1;
solve(n - tmp, ii - tmp, jj - tmp, di + tmp, dj + tmp);
}
}
int main()
{
//#ifndef ONLINE_JUDGE
// freopen("test.in", "r", stdin);
// freopen("test.out", "w", stdout);
// int startTime = clock();
//#endif
cin >> n >> bi >> bj;
solve(n, bi, bj, 0, 0);
cout << "Yes" << endl;
cout << anss.size() << endl;
for (auto& tp : anss)
{
printf("%d %d %d %d\n", get<0>(tp), get<1>(tp), get<2>(tp), get<3>(tp));
}
#ifndef ONLINE_JUDGE
printf("Time = %dms\n", clock() - startTime);
#endif
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3552kb
input:
5 3 4
output:
Yes 4 5 5 -4 -4 1 1 3 3 2 2 2 2 4 3 -1 1
result:
ok Correct. (1 test case)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3508kb
input:
1 1 1
output:
Yes 0
result:
ok Correct. (1 test case)
Test #3:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
3 2 3
output:
Yes 2 1 1 2 2 3 2 -1 1
result:
ok Correct. (1 test case)
Test #4:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
10 10 5
output:
Yes 9 1 1 9 9 2 2 8 8 3 3 7 7 4 4 6 6 5 10 5 -5 6 9 4 -4 7 8 3 -3 8 7 2 -2 9 6 1 -1
result:
ok Correct. (1 test case)
Test #5:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
10 5 7
output:
Yes 9 8 8 -7 -7 9 9 -8 -8 10 10 -9 -9 1 1 6 6 2 2 5 5 3 3 4 4 4 4 3 3 7 5 -2 2 6 6 -1 1
result:
ok Correct. (1 test case)
Test #6:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
10 9 2
output:
Yes 9 10 10 -9 -9 1 1 8 8 2 9 7 -7 3 8 6 -6 4 7 5 -5 5 6 4 -4 6 5 3 -3 7 4 2 -2 8 3 1 -1
result:
ok Correct. (1 test case)
Test #7:
score: 0
Accepted
time: 1ms
memory: 3532kb
input:
10 6 10
output:
Yes 9 1 1 9 9 2 2 8 8 3 3 7 7 4 4 6 6 5 5 5 5 10 6 -4 4 9 7 -3 3 8 8 -2 2 7 9 -1 1
result:
ok Correct. (1 test case)
Test #8:
score: 0
Accepted
time: 1ms
memory: 3468kb
input:
10 8 4
output:
Yes 9 9 9 -8 -8 10 10 -9 -9 1 1 7 7 2 2 6 6 3 3 5 5 4 8 4 -4 5 7 3 -3 6 6 2 -2 7 5 1 -1
result:
ok Correct. (1 test case)
Test #9:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
999 396 693
output:
Yes 998 694 694 -693 -693 695 695 -694 -694 696 696 -695 -695 697 697 -696 -696 698 698 -697 -697 699 699 -698 -698 700 700 -699 -699 701 701 -700 -700 702 702 -701 -701 703 703 -702 -702 704 704 -703 -703 705 705 -704 -704 706 706 -705 -705 707 707 -706 -706 708 708 -707 -707 709 709 -708 -708 710 ...
result:
ok Correct. (1 test case)
Test #10:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
999 963 827
output:
Yes 998 964 964 -963 -963 965 965 -964 -964 966 966 -965 -965 967 967 -966 -966 968 968 -967 -967 969 969 -968 -968 970 970 -969 -969 971 971 -970 -970 972 972 -971 -971 973 973 -972 -972 974 974 -973 -973 975 975 -974 -974 976 976 -975 -975 977 977 -976 -976 978 978 -977 -977 979 979 -978 -978 980 ...
result:
ok Correct. (1 test case)
Test #11:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
999 871 185
output:
Yes 998 872 872 -871 -871 873 873 -872 -872 874 874 -873 -873 875 875 -874 -874 876 876 -875 -875 877 877 -876 -876 878 878 -877 -877 879 879 -878 -878 880 880 -879 -879 881 881 -880 -880 882 882 -881 -881 883 883 -882 -882 884 884 -883 -883 885 885 -884 -884 886 886 -885 -885 887 887 -886 -886 888 ...
result:
ok Correct. (1 test case)
Test #12:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
999 787 812
output:
Yes 998 813 813 -812 -812 814 814 -813 -813 815 815 -814 -814 816 816 -815 -815 817 817 -816 -816 818 818 -817 -817 819 819 -818 -818 820 820 -819 -819 821 821 -820 -820 822 822 -821 -821 823 823 -822 -822 824 824 -823 -823 825 825 -824 -824 826 826 -825 -825 827 827 -826 -826 828 828 -827 -827 829 ...
result:
ok Correct. (1 test case)
Test #13:
score: 0
Accepted
time: 1ms
memory: 3488kb
input:
999 396 199
output:
Yes 998 397 397 -396 -396 398 398 -397 -397 399 399 -398 -398 400 400 -399 -399 401 401 -400 -400 402 402 -401 -401 403 403 -402 -402 404 404 -403 -403 405 405 -404 -404 406 406 -405 -405 407 407 -406 -406 408 408 -407 -407 409 409 -408 -408 410 410 -409 -409 411 411 -410 -410 412 412 -411 -411 413 ...
result:
ok Correct. (1 test case)
Test #14:
score: 0
Accepted
time: 1ms
memory: 3604kb
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: 3564kb
input:
999 163 1
output:
Yes 998 164 164 -163 -163 165 165 -164 -164 166 166 -165 -165 167 167 -166 -166 168 168 -167 -167 169 169 -168 -168 170 170 -169 -169 171 171 -170 -170 172 172 -171 -171 173 173 -172 -172 174 174 -173 -173 175 175 -174 -174 176 176 -175 -175 177 177 -176 -176 178 178 -177 -177 179 179 -178 -178 180 ...
result:
ok Correct. (1 test case)
Test #16:
score: 0
Accepted
time: 1ms
memory: 3600kb
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: 0ms
memory: 3836kb
input:
999 1 969
output:
Yes 998 970 970 -969 -969 971 971 -970 -970 972 972 -971 -971 973 973 -972 -972 974 974 -973 -973 975 975 -974 -974 976 976 -975 -975 977 977 -976 -976 978 978 -977 -977 979 979 -978 -978 980 980 -979 -979 981 981 -980 -980 982 982 -981 -981 983 983 -982 -982 984 984 -983 -983 985 985 -984 -984 986 ...
result:
ok Correct. (1 test case)
Test #18:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
999 999 780
output:
Yes 998 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 977 977 23...
result:
ok Correct. (1 test case)
Test #19:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
999 1 999
output:
Yes 998 999 1 -998 998 998 2 -997 997 997 3 -996 996 996 4 -995 995 995 5 -994 994 994 6 -993 993 993 7 -992 992 992 8 -991 991 991 9 -990 990 990 10 -989 989 989 11 -988 988 988 12 -987 987 987 13 -986 986 986 14 -985 985 985 15 -984 984 984 16 -983 983 983 17 -982 982 982 18 -981 981 981 19 -980 9...
result:
ok Correct. (1 test case)
Test #20:
score: 0
Accepted
time: 1ms
memory: 3492kb
input:
999 686 999
output:
Yes 998 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 977 977 23...
result:
ok Correct. (1 test case)
Test #21:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
999 999 999
output:
Yes 998 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 977 977 23...
result:
ok Correct. (1 test case)
Test #22:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
1000 757 728
output:
Yes 999 758 758 -757 -757 759 759 -758 -758 760 760 -759 -759 761 761 -760 -760 762 762 -761 -761 763 763 -762 -762 764 764 -763 -763 765 765 -764 -764 766 766 -765 -765 767 767 -766 -766 768 768 -767 -767 769 769 -768 -768 770 770 -769 -769 771 771 -770 -770 772 772 -771 -771 773 773 -772 -772 774 ...
result:
ok Correct. (1 test case)
Test #23:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
1000 132 993
output:
Yes 999 994 994 -993 -993 995 995 -994 -994 996 996 -995 -995 997 997 -996 -996 998 998 -997 -997 999 999 -998 -998 1000 1000 -999 -999 1 1 992 992 2 2 991 991 3 3 990 990 4 4 989 989 5 5 988 988 6 6 987 987 7 7 986 986 8 8 985 985 9 9 984 984 10 10 983 983 11 11 982 982 12 12 981 981 13 13 980 980 ...
result:
ok Correct. (1 test case)
Test #24:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
1000 703 499
output:
Yes 999 704 704 -703 -703 705 705 -704 -704 706 706 -705 -705 707 707 -706 -706 708 708 -707 -707 709 709 -708 -708 710 710 -709 -709 711 711 -710 -710 712 712 -711 -711 713 713 -712 -712 714 714 -713 -713 715 715 -714 -714 716 716 -715 -715 717 717 -716 -716 718 718 -717 -717 719 719 -718 -718 720 ...
result:
ok Correct. (1 test case)
Test #25:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
1000 910 298
output:
Yes 999 911 911 -910 -910 912 912 -911 -911 913 913 -912 -912 914 914 -913 -913 915 915 -914 -914 916 916 -915 -915 917 917 -916 -916 918 918 -917 -917 919 919 -918 -918 920 920 -919 -919 921 921 -920 -920 922 922 -921 -921 923 923 -922 -922 924 924 -923 -923 925 925 -924 -924 926 926 -925 -925 927 ...
result:
ok Correct. (1 test case)
Test #26:
score: 0
Accepted
time: 1ms
memory: 3544kb
input:
1000 171 322
output:
Yes 999 323 323 -322 -322 324 324 -323 -323 325 325 -324 -324 326 326 -325 -325 327 327 -326 -326 328 328 -327 -327 329 329 -328 -328 330 330 -329 -329 331 331 -330 -330 332 332 -331 -331 333 333 -332 -332 334 334 -333 -333 335 335 -334 -334 336 336 -335 -335 337 337 -336 -336 338 338 -337 -337 339 ...
result:
ok Correct. (1 test case)
Test #27:
score: 0
Accepted
time: 1ms
memory: 3528kb
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: 3776kb
input:
1000 480 1
output:
Yes 999 481 481 -480 -480 482 482 -481 -481 483 483 -482 -482 484 484 -483 -483 485 485 -484 -484 486 486 -485 -485 487 487 -486 -486 488 488 -487 -487 489 489 -488 -488 490 490 -489 -489 491 491 -490 -490 492 492 -491 -491 493 493 -492 -492 494 494 -493 -493 495 495 -494 -494 496 496 -495 -495 497 ...
result:
ok Correct. (1 test case)
Test #29:
score: 0
Accepted
time: 1ms
memory: 3532kb
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: 1ms
memory: 3776kb
input:
1000 1 339
output:
Yes 999 340 340 -339 -339 341 341 -340 -340 342 342 -341 -341 343 343 -342 -342 344 344 -343 -343 345 345 -344 -344 346 346 -345 -345 347 347 -346 -346 348 348 -347 -347 349 349 -348 -348 350 350 -349 -349 351 351 -350 -350 352 352 -351 -351 353 353 -352 -352 354 354 -353 -353 355 355 -354 -354 356 ...
result:
ok Correct. (1 test case)
Test #31:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
1000 1000 161
output:
Yes 999 1 1 999 999 2 2 998 998 3 3 997 997 4 4 996 996 5 5 995 995 6 6 994 994 7 7 993 993 8 8 992 992 9 9 991 991 10 10 990 990 11 11 989 989 12 12 988 988 13 13 987 987 14 14 986 986 15 15 985 985 16 16 984 984 17 17 983 983 18 18 982 982 19 19 981 981 20 20 980 980 21 21 979 979 22 22 978 978 23...
result:
ok Correct. (1 test case)
Test #32:
score: 0
Accepted
time: 1ms
memory: 3532kb
input:
1000 1 1000
output:
Yes 999 1000 1 -999 999 999 2 -998 998 998 3 -997 997 997 4 -996 996 996 5 -995 995 995 6 -994 994 994 7 -993 993 993 8 -992 992 992 9 -991 991 991 10 -990 990 990 11 -989 989 989 12 -988 988 988 13 -987 987 987 14 -986 986 986 15 -985 985 985 16 -984 984 984 17 -983 983 983 18 -982 982 982 19 -981 ...
result:
ok Correct. (1 test case)
Test #33:
score: 0
Accepted
time: 1ms
memory: 3560kb
input:
1000 759 1000
output:
Yes 999 1 1 999 999 2 2 998 998 3 3 997 997 4 4 996 996 5 5 995 995 6 6 994 994 7 7 993 993 8 8 992 992 9 9 991 991 10 10 990 990 11 11 989 989 12 12 988 988 13 13 987 987 14 14 986 986 15 15 985 985 16 16 984 984 17 17 983 983 18 18 982 982 19 19 981 981 20 20 980 980 21 21 979 979 22 22 978 978 23...
result:
ok Correct. (1 test case)
Test #34:
score: 0
Accepted
time: 1ms
memory: 3532kb
input:
1000 1000 1000
output:
Yes 999 1 1 999 999 2 2 998 998 3 3 997 997 4 4 996 996 5 5 995 995 6 6 994 994 7 7 993 993 8 8 992 992 9 9 991 991 10 10 990 990 11 11 989 989 12 12 988 988 13 13 987 987 14 14 986 986 15 15 985 985 16 16 984 984 17 17 983 983 18 18 982 982 19 19 981 981 20 20 980 980 21 21 979 979 22 22 978 978 23...
result:
ok Correct. (1 test case)
Test #35:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
2 1 1
output:
Yes 1 2 2 -1 -1
result:
ok Correct. (1 test case)
Test #36:
score: 0
Accepted
time: 1ms
memory: 3744kb
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: 3500kb
input:
2 2 1
output:
Yes 1 1 2 1 -1
result:
ok Correct. (1 test case)
Test #38:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
2 2 2
output:
Yes 1 1 1 1 1
result:
ok Correct. (1 test case)
Test #39:
score: 0
Accepted
time: 1ms
memory: 3832kb
input:
810 114 514
output:
Yes 809 515 515 -514 -514 516 516 -515 -515 517 517 -516 -516 518 518 -517 -517 519 519 -518 -518 520 520 -519 -519 521 521 -520 -520 522 522 -521 -521 523 523 -522 -522 524 524 -523 -523 525 525 -524 -524 526 526 -525 -525 527 527 -526 -526 528 528 -527 -527 529 529 -528 -528 530 530 -529 -529 531 ...
result:
ok Correct. (1 test case)
Test #40:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
810 514 114
output:
Yes 809 515 515 -514 -514 516 516 -515 -515 517 517 -516 -516 518 518 -517 -517 519 519 -518 -518 520 520 -519 -519 521 521 -520 -520 522 522 -521 -521 523 523 -522 -522 524 524 -523 -523 525 525 -524 -524 526 526 -525 -525 527 527 -526 -526 528 528 -527 -527 529 529 -528 -528 530 530 -529 -529 531 ...
result:
ok Correct. (1 test case)