QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#694882#6677. Puzzle: SashiganemonuiWA 1ms5744kbC++232.8kb2024-10-31 18:52:412024-10-31 18:52:52

Judging History

你现在查看的是最新测评结果

  • [2024-10-31 18:52:52]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5744kb
  • [2024-10-31 18:52:41]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
const int N=1e5+10;
int n,bi,bj;
int num=0;
struct sb{
    int r,c,h,w;
}que[N];


void solve(){
    cin>>n>>bi>>bj;
    int i1,j1,i2,j2,di,dj;
    if(n%2==0){
        if(bi<=n/2) di=n/2-bi;
        else di=n/2+1-bi;
        if(bj<=n/2) dj=n/2-bj;
        else dj=n/2+1-bj;
        int len=max(abs(di),abs(dj));
        i1=n/2-len;
        j1=n/2-len;
        i2=n/2+1+len;
        j2=n/2+1+len;
    }
    else{
        int mid=(n/2+1);
        di=mid-bi;
        dj=mid-bj;
        int len=max(abs(di),abs(dj));
        i1=mid-len;
        j1=mid-len;
        i2=mid+len;
        j2=mid+len;
    }
    
    if((dj>=0&&abs(dj)>=abs(di))||(di>=0&&abs(di)>=abs(dj))){
        for(int i=bi+1,j=bj+1;i<=i2&&j<=j2;i++,j++){
            ++num;
            que[num].r=i,que[num].c=j;
            que[num].h=-(i-bi);
            que[num].w=-(j-bj);
        }//往右下走的
        int pp=abs(que[num].h);
        auto& cur=que[num];
        if(num==0) cur.r=bi,cur.c=bj;
        for(int i=bi-1,j=cur.c+1;i>=i1&&j<=j2;i--,j++){
            ++num;
            que[num].r=i,que[num].c=j;
            que[num].h=-(i-bi-pp);
            que[num].w=-(j-cur.c+pp);
        }
        
        for(int i=cur.r+1,j=bj-1;i<=i2&&j>=j1;i++,j--){
            ++num;
            que[num].r=i,que[num].c=j;
            que[num].h=-(i-cur.r+pp);
            que[num].w=-(j-bj-pp);
        }
    }
    else{
        //往左上走
        for(int i=bi-1,j=bj-1;i>=i1&&j>=j1;i--,j--){
            ++num;
            que[num].r=i,que[num].c=j;
            que[num].h=-(i-bi);
            que[num].w=-(j-bj);
        }
        int pp=abs(que[num].h);
        auto& cur=que[num];
        if(num==0) cur.r=bi,cur.c=bj;
        for(int i=bi+1,j=cur.c-1;i<=i2&&j>=j1;i++,j--){
            ++num;
            que[num].r=i,que[num].c=j;
            que[num].h=-(i-bi+pp);
            que[num].w=-(j-cur.c-pp);
        }
        
        for(int i=cur.r-1,j=bj+1;i>=i1&&j<=j2;i--,j++){
            ++num;
            que[num].r=i,que[num].c=j;
            que[num].h=-(i-cur.r-pp);
            que[num].w=-(j-bj+pp);
        }
    }
    
    for(int i=i1-1,j=j1-1;i>0&&j>0;i--,j--){
        ++num;
        que[num].r=i,que[num].c=j;
        que[num].h=i2-i;que[num].w=j2-j;
    }
    for(int i=i2+1,j=j2+1;i<=n&&j<=n;i++,j++){
        ++num;
        que[num].r=i,que[num].c=j;
        que[num].h=1-i;que[num].w=1-j;
    }
    //cout<<i1<<" "<<j1<<" "<<i2<<" "<<j2<<endl;
    cout<<"YES"<<endl;
    cout<<num<<endl;
    for(int i=1;i<=num;i++) cout<<que[i].r<<" "<<que[i].c<<" "<<que[i].h<<" "<<que[i].w<<endl;
}

signed main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3640kb

input:

5 3 4

output:

YES
4
2 3 1 1
4 2 -2 2
1 1 3 3
5 5 -4 -4

result:

ok Correct. (1 test case)

Test #2:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

1 1 1

output:

YES
0

result:

ok Correct. (1 test case)

Test #3:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

3 2 3

output:

YES
2
1 2 1 1
3 1 -2 2

result:

ok Correct. (1 test case)

Test #4:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

10 10 5

output:

YES
9
9 4 1 1
8 3 2 2
7 2 3 3
6 1 4 4
5 6 5 -5
4 7 6 -6
3 8 7 -7
2 9 8 -8
1 10 9 -9

result:

ok Correct. (1 test case)

Test #5:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

10 5 7

output:

YES
9
4 6 1 1
6 5 -2 2
7 4 -3 3
3 3 4 4
2 2 5 5
1 1 6 6
8 8 -7 -7
9 9 -8 -8
10 10 -9 -9

result:

ok Correct. (1 test case)

Test #6:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

10 9 2

output:

YES
9
8 3 1 -1
7 4 2 -2
6 5 3 -3
5 6 4 -4
4 7 5 -5
3 8 6 -6
2 9 7 -7
1 1 8 8
10 10 -9 -9

result:

ok Correct. (1 test case)

Test #7:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

10 6 10

output:

YES
9
5 9 1 1
4 8 2 2
3 7 3 3
2 6 4 4
1 5 5 5
7 4 -6 6
8 3 -7 7
9 2 -8 8
10 1 -9 9

result:

ok Correct. (1 test case)

Test #8:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

10 8 4

output:

YES
9
7 3 1 1
6 5 2 -2
5 6 3 -3
4 7 4 -4
3 8 5 -5
2 2 6 6
1 1 7 7
9 9 -8 -8
10 10 -9 -9

result:

ok Correct. (1 test case)

Test #9:

score: 0
Accepted
time: 1ms
memory: 3684kb

input:

999 396 693

output:

YES
998
395 692 1 1
394 691 2 2
393 690 3 3
392 689 4 4
391 688 5 5
390 687 6 6
389 686 7 7
388 685 8 8
387 684 9 9
386 683 10 10
385 682 11 11
384 681 12 12
383 680 13 13
382 679 14 14
381 678 15 15
380 677 16 16
379 676 17 17
378 675 18 18
377 674 19 19
376 673 20 20
375 672 21 21
374 671 22 22
37...

result:

ok Correct. (1 test case)

Test #10:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

999 963 827

output:

YES
998
962 826 1 1
961 825 2 2
960 824 3 3
959 823 4 4
958 822 5 5
957 821 6 6
956 820 7 7
955 819 8 8
954 818 9 9
953 817 10 10
952 816 11 11
951 815 12 12
950 814 13 13
949 813 14 14
948 812 15 15
947 811 16 16
946 810 17 17
945 809 18 18
944 808 19 19
943 807 20 20
942 806 21 21
941 805 22 22
94...

result:

ok Correct. (1 test case)

Test #11:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

999 871 185

output:

YES
998
870 184 1 1
869 183 2 2
868 182 3 3
867 181 4 4
866 180 5 5
865 179 6 6
864 178 7 7
863 177 8 8
862 176 9 9
861 175 10 10
860 174 11 11
859 173 12 12
858 172 13 13
857 171 14 14
856 170 15 15
855 169 16 16
854 168 17 17
853 167 18 18
852 166 19 19
851 165 20 20
850 164 21 21
849 163 22 22
84...

result:

ok Correct. (1 test case)

Test #12:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

999 787 812

output:

YES
998
786 811 1 1
785 810 2 2
784 809 3 3
783 808 4 4
782 807 5 5
781 806 6 6
780 805 7 7
779 804 8 8
778 803 9 9
777 802 10 10
776 801 11 11
775 800 12 12
774 799 13 13
773 798 14 14
772 797 15 15
771 796 16 16
770 795 17 17
769 794 18 18
768 793 19 19
767 792 20 20
766 791 21 21
765 790 22 22
76...

result:

ok Correct. (1 test case)

Test #13:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

999 396 199

output:

YES
998
397 200 -1 -1
398 201 -2 -2
399 202 -3 -3
400 203 -4 -4
401 204 -5 -5
402 205 -6 -6
403 206 -7 -7
404 207 -8 -8
405 208 -9 -9
406 209 -10 -10
407 210 -11 -11
408 211 -12 -12
409 212 -13 -13
410 213 -14 -14
411 214 -15 -15
412 215 -16 -16
413 216 -17 -17
414 217 -18 -18
415 218 -19 -19
416 21...

result:

ok Correct. (1 test case)

Test #14:

score: 0
Accepted
time: 1ms
memory: 3696kb

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: 3740kb

input:

999 163 1

output:

YES
998
164 2 -1 -1
165 3 -2 -2
166 4 -3 -3
167 5 -4 -4
168 6 -5 -5
169 7 -6 -6
170 8 -7 -7
171 9 -8 -8
172 10 -9 -9
173 11 -10 -10
174 12 -11 -11
175 13 -12 -12
176 14 -13 -13
177 15 -14 -14
178 16 -15 -15
179 17 -16 -16
180 18 -17 -17
181 19 -18 -18
182 20 -19 -19
183 21 -20 -20
184 22 -21 -21
185...

result:

ok Correct. (1 test case)

Test #16:

score: 0
Accepted
time: 1ms
memory: 3696kb

input:

999 999 1

output:

YES
998
998 2 1 -1
997 3 2 -2
996 4 3 -3
995 5 4 -4
994 6 5 -5
993 7 6 -6
992 8 7 -7
991 9 8 -8
990 10 9 -9
989 11 10 -10
988 12 11 -11
987 13 12 -12
986 14 13 -13
985 15 14 -14
984 16 15 -15
983 17 16 -16
982 18 17 -17
981 19 18 -18
980 20 19 -19
979 21 20 -20
978 22 21 -21
977 23 22 -22
976 24 23 ...

result:

ok Correct. (1 test case)

Test #17:

score: 0
Accepted
time: 1ms
memory: 3684kb

input:

999 1 969

output:

YES
998
2 970 -1 -1
3 971 -2 -2
4 972 -3 -3
5 973 -4 -4
6 974 -5 -5
7 975 -6 -6
8 976 -7 -7
9 977 -8 -8
10 978 -9 -9
11 979 -10 -10
12 980 -11 -11
13 981 -12 -12
14 982 -13 -13
15 983 -14 -14
16 984 -15 -15
17 985 -16 -16
18 986 -17 -17
19 987 -18 -18
20 988 -19 -19
21 989 -20 -20
22 990 -21 -21
23 ...

result:

ok Correct. (1 test case)

Test #18:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

999 999 780

output:

YES
998
998 779 1 1
997 778 2 2
996 777 3 3
995 776 4 4
994 775 5 5
993 774 6 6
992 773 7 7
991 772 8 8
990 771 9 9
989 770 10 10
988 769 11 11
987 768 12 12
986 767 13 13
985 766 14 14
984 765 15 15
983 764 16 16
982 763 17 17
981 762 18 18
980 761 19 19
979 760 20 20
978 759 21 21
977 758 22 22
97...

result:

ok Correct. (1 test case)

Test #19:

score: 0
Accepted
time: 1ms
memory: 3704kb

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: 3680kb

input:

999 686 999

output:

YES
998
685 998 1 1
684 997 2 2
683 996 3 3
682 995 4 4
681 994 5 5
680 993 6 6
679 992 7 7
678 991 8 8
677 990 9 9
676 989 10 10
675 988 11 11
674 987 12 12
673 986 13 13
672 985 14 14
671 984 15 15
670 983 16 16
669 982 17 17
668 981 18 18
667 980 19 19
666 979 20 20
665 978 21 21
664 977 22 22
66...

result:

ok Correct. (1 test case)

Test #21:

score: 0
Accepted
time: 1ms
memory: 3704kb

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: 5744kb

input:

1000 757 728

output:

YES
999
756 727 1 1
755 726 2 2
754 725 3 3
753 724 4 4
752 723 5 5
751 722 6 6
750 721 7 7
749 720 8 8
748 719 9 9
747 718 10 10
746 717 11 11
745 716 12 12
744 715 13 13
743 714 14 14
742 713 15 15
741 712 16 16
740 711 17 17
739 710 18 18
738 709 19 19
737 708 20 20
736 707 21 21
735 706 22 22
73...

result:

ok Correct. (1 test case)

Test #23:

score: 0
Accepted
time: 1ms
memory: 3684kb

input:

1000 132 993

output:

YES
999
131 992 1 1
130 991 2 2
129 990 3 3
128 989 4 4
127 988 5 5
126 987 6 6
125 986 7 7
124 985 8 8
123 984 9 9
122 983 10 10
121 982 11 11
120 981 12 12
119 980 13 13
118 979 14 14
117 978 15 15
116 977 16 16
115 976 17 17
114 975 18 18
113 974 19 19
112 973 20 20
111 972 21 21
110 971 22 22
10...

result:

ok Correct. (1 test case)

Test #24:

score: 0
Accepted
time: 1ms
memory: 3696kb

input:

1000 703 499

output:

YES
999
702 498 1 1
701 497 2 2
700 496 3 3
699 495 4 4
698 494 5 5
697 493 6 6
696 492 7 7
695 491 8 8
694 490 9 9
693 489 10 10
692 488 11 11
691 487 12 12
690 486 13 13
689 485 14 14
688 484 15 15
687 483 16 16
686 482 17 17
685 481 18 18
684 480 19 19
683 479 20 20
682 478 21 21
681 477 22 22
68...

result:

ok Correct. (1 test case)

Test #25:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

1000 910 298

output:

YES
999
909 297 1 1
908 296 2 2
907 295 3 3
906 294 4 4
905 293 5 5
904 292 6 6
903 291 7 7
902 290 8 8
901 289 9 9
900 288 10 10
899 287 11 11
898 286 12 12
897 285 13 13
896 284 14 14
895 283 15 15
894 282 16 16
893 281 17 17
892 280 18 18
891 279 19 19
890 278 20 20
889 277 21 21
888 276 22 22
88...

result:

ok Correct. (1 test case)

Test #26:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

1000 171 322

output:

YES
999
172 323 -1 -1
173 324 -2 -2
174 325 -3 -3
175 326 -4 -4
176 327 -5 -5
177 328 -6 -6
178 329 -7 -7
179 330 -8 -8
180 331 -9 -9
181 332 -10 -10
182 333 -11 -11
183 334 -12 -12
184 335 -13 -13
185 336 -14 -14
186 337 -15 -15
187 338 -16 -16
188 339 -17 -17
189 340 -18 -18
190 341 -19 -19
191 34...

result:

ok Correct. (1 test case)

Test #27:

score: 0
Accepted
time: 1ms
memory: 3688kb

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: 3628kb

input:

1000 480 1

output:

YES
999
481 2 -1 -1
482 3 -2 -2
483 4 -3 -3
484 5 -4 -4
485 6 -5 -5
486 7 -6 -6
487 8 -7 -7
488 9 -8 -8
489 10 -9 -9
490 11 -10 -10
491 12 -11 -11
492 13 -12 -12
493 14 -13 -13
494 15 -14 -14
495 16 -15 -15
496 17 -16 -16
497 18 -17 -17
498 19 -18 -18
499 20 -19 -19
500 21 -20 -20
501 22 -21 -21
502...

result:

ok Correct. (1 test case)

Test #29:

score: 0
Accepted
time: 0ms
memory: 3744kb

input:

1000 1000 1

output:

YES
999
999 2 1 -1
998 3 2 -2
997 4 3 -3
996 5 4 -4
995 6 5 -5
994 7 6 -6
993 8 7 -7
992 9 8 -8
991 10 9 -9
990 11 10 -10
989 12 11 -11
988 13 12 -12
987 14 13 -13
986 15 14 -14
985 16 15 -15
984 17 16 -16
983 18 17 -17
982 19 18 -18
981 20 19 -19
980 21 20 -20
979 22 21 -21
978 23 22 -22
977 24 23 ...

result:

ok Correct. (1 test case)

Test #30:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

1000 1 339

output:

YES
999
2 340 -1 -1
3 341 -2 -2
4 342 -3 -3
5 343 -4 -4
6 344 -5 -5
7 345 -6 -6
8 346 -7 -7
9 347 -8 -8
10 348 -9 -9
11 349 -10 -10
12 350 -11 -11
13 351 -12 -12
14 352 -13 -13
15 353 -14 -14
16 354 -15 -15
17 355 -16 -16
18 356 -17 -17
19 357 -18 -18
20 358 -19 -19
21 359 -20 -20
22 360 -21 -21
23 ...

result:

ok Correct. (1 test case)

Test #31:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

1000 1000 161

output:

YES
999
999 160 1 1
998 159 2 2
997 158 3 3
996 157 4 4
995 156 5 5
994 155 6 6
993 154 7 7
992 153 8 8
991 152 9 9
990 151 10 10
989 150 11 11
988 149 12 12
987 148 13 13
986 147 14 14
985 146 15 15
984 145 16 16
983 144 17 17
982 143 18 18
981 142 19 19
980 141 20 20
979 140 21 21
978 139 22 22
97...

result:

ok Correct. (1 test case)

Test #32:

score: 0
Accepted
time: 1ms
memory: 3704kb

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: 3680kb

input:

1000 759 1000

output:

YES
999
758 999 1 1
757 998 2 2
756 997 3 3
755 996 4 4
754 995 5 5
753 994 6 6
752 993 7 7
751 992 8 8
750 991 9 9
749 990 10 10
748 989 11 11
747 988 12 12
746 987 13 13
745 986 14 14
744 985 15 15
743 984 16 16
742 983 17 17
741 982 18 18
740 981 19 19
739 980 20 20
738 979 21 21
737 978 22 22
73...

result:

ok Correct. (1 test case)

Test #34:

score: 0
Accepted
time: 1ms
memory: 3752kb

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: 3596kb

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: 3712kb

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: 3652kb

input:

2 2 1

output:

YES
1
1 2 1 -1

result:

ok Correct. (1 test case)

Test #38:

score: -100
Wrong Answer
time: 0ms
memory: 3584kb

input:

2 2 2

output:

YES
0

result:

wrong answer At least one cell is left uncovered. (test case 1)