QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#676702#6677. Puzzle: SashiganeAnon_chan#AC ✓2ms3728kbC++201.3kb2024-10-25 23:17:182024-10-25 23:17:19

Judging History

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

  • [2024-10-25 23:17:19]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3728kb
  • [2024-10-25 23:17:18]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e3+10;
const ll INF=1e11+10;
ll n,X,Y,cnt=0;
ll mp[N][N];
ll r[N],cc[N],h[N],w[N];
void dfs(ll x,ll y,ll len){
	if(len==1)return;
	ll Len=len;
	len=(len+1)/2;
	ll midx=x-1+len,midy=y-1+len;
	if(X<=midx&&Y<=midy){
		dfs(x,y,len);
		for(ll i=Len;i>len;--i){
			r[++cnt]=x-1+i;
			cc[cnt]=y-1+i;
			h[cnt]=-(i-1);
			w[cnt]=-(i-1);
		}
	}else if(X<=midx&&midy<=Y){
		dfs(x,midy+((Len&1LL)==0),len);
		for(ll i=Len;i>len;--i){
			r[++cnt]=x-1+i;
			cc[cnt]=y+(Len-i);
			h[cnt]=(i-1);
			w[cnt]=-(i-1);
		}
	}else if(midx<=X&&Y<=midy){
		dfs(midx+((Len&1LL)==0),y,len);
		for(ll i=Len;i>len;--i){
			r[++cnt]=x+(Len-i);
			cc[cnt]=y-1+i;
			h[cnt]=-(i-1);
			w[cnt]=(i-1);
		}
	}else {
		dfs(midx+((Len&1LL)==0),midy+((Len&1LL)==0),len);
		for(ll i=Len;i>len;--i){
			r[++cnt]=x+(Len-i);
			cc[cnt]=y+(Len-i);
			h[cnt]=i-1;
			w[cnt]=i-1;
		}
	}
}

void solve(void){
	cin>>n>>Y>>X;
	dfs(1,1,n);
	cout<<"Yes\n";
	cout<<cnt<<endl;
	for(ll i=1;i<=cnt;++i){
		cout<<cc[i]<<' '<<r[i]<<' '<<h[i]<<' '<<w[i]<<endl;
	}


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

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 3 4

output:

Yes
4
2 3 1 1
1 5 2 -2
5 1 -4 4
4 2 -3 3

result:

ok Correct. (1 test case)

Test #2:

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

input:

1 1 1

output:

Yes
0

result:

ok Correct. (1 test case)

Test #3:

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

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

input:

10 10 5

output:

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

result:

ok Correct. (1 test case)

Test #5:

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

input:

10 5 7

output:

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

result:

ok Correct. (1 test case)

Test #6:

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

input:

10 9 2

output:

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

result:

ok Correct. (1 test case)

Test #7:

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

input:

10 6 10

output:

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

result:

ok Correct. (1 test case)

Test #8:

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

input:

10 8 4

output:

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

result:

ok Correct. (1 test case)

Test #9:

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

input:

999 396 693

output:

Yes
998
397 694 -1 -1
399 691 -3 3
398 692 -2 2
392 687 7 7
393 688 6 6
394 689 5 5
395 690 4 4
407 702 -15 -15
406 701 -14 -14
405 700 -13 -13
404 699 -12 -12
403 698 -11 -11
402 697 -10 -10
401 696 -9 -9
400 695 -8 -8
376 718 31 -31
377 717 30 -30
378 716 29 -29
379 715 28 -28
380 714 27 -27
381 7...

result:

ok Correct. (1 test case)

Test #10:

score: 0
Accepted
time: 2ms
memory: 3728kb

input:

999 963 827

output:

Yes
998
964 826 -1 1
961 824 3 3
962 825 2 2
968 820 -7 7
967 821 -6 6
966 822 -5 5
965 823 -4 4
953 812 15 15
954 813 14 14
955 814 13 13
956 815 12 12
957 816 11 11
958 817 10 10
959 818 9 9
960 819 8 8
937 843 31 -31
938 842 30 -30
939 841 29 -29
940 840 28 -28
941 839 27 -27
942 838 26 -26
943 8...

result:

ok Correct. (1 test case)

Test #11:

score: 0
Accepted
time: 2ms
memory: 3668kb

input:

999 871 185

output:

Yes
998
872 186 -1 -1
874 188 -3 -3
873 187 -2 -2
867 181 7 7
868 182 6 6
869 183 5 5
870 184 4 4
859 173 15 15
860 174 14 14
861 175 13 13
862 176 12 12
863 177 11 11
864 178 10 10
865 179 9 9
866 180 8 8
843 157 31 31
844 158 30 30
845 159 29 29
846 160 28 28
847 161 27 27
848 162 26 26
849 163 25...

result:

ok Correct. (1 test case)

Test #12:

score: 0
Accepted
time: 2ms
memory: 3644kb

input:

999 787 812

output:

Yes
998
788 811 -1 1
785 809 3 3
786 810 2 2
781 805 7 7
782 806 6 6
783 807 5 5
784 808 4 4
796 797 -15 15
795 798 -14 14
794 799 -13 13
793 800 -12 12
792 801 -11 11
791 802 -10 10
790 803 -9 9
789 804 -8 8
812 781 -31 31
811 782 -30 30
810 783 -29 29
809 784 -28 28
808 785 -27 27
807 786 -26 26
8...

result:

ok Correct. (1 test case)

Test #13:

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

input:

999 396 199

output:

Yes
998
397 198 -1 1
399 196 -3 3
398 197 -2 2
392 203 7 -7
393 202 6 -6
394 201 5 -5
395 200 4 -4
407 188 -15 15
406 189 -14 14
405 190 -13 13
404 191 -12 12
403 192 -11 11
402 193 -10 10
401 194 -9 9
400 195 -8 8
376 219 31 -31
377 218 30 -30
378 217 29 -29
379 216 28 -28
380 215 27 -27
381 214 26...

result:

ok Correct. (1 test case)

Test #14:

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

input:

999 1 1

output:

Yes
998
2 2 -1 -1
4 4 -3 -3
3 3 -2 -2
8 8 -7 -7
7 7 -6 -6
6 6 -5 -5
5 5 -4 -4
16 16 -15 -15
15 15 -14 -14
14 14 -13 -13
13 13 -12 -12
12 12 -11 -11
11 11 -10 -10
10 10 -9 -9
9 9 -8 -8
32 32 -31 -31
31 31 -30 -30
30 30 -29 -29
29 29 -28 -28
28 28 -27 -27
27 27 -26 -26
26 26 -25 -25
25 25 -24 -24
24 2...

result:

ok Correct. (1 test case)

Test #15:

score: 0
Accepted
time: 2ms
memory: 3592kb

input:

999 163 1

output:

Yes
998
164 2 -1 -1
161 4 3 -3
162 3 2 -2
157 8 7 -7
158 7 6 -6
159 6 5 -5
160 5 4 -4
172 16 -15 -15
171 15 -14 -14
170 14 -13 -13
169 13 -12 -12
168 12 -11 -11
167 11 -10 -10
166 10 -9 -9
165 9 -8 -8
188 32 -31 -31
187 31 -30 -30
186 30 -29 -29
185 29 -28 -28
184 28 -27 -27
183 27 -26 -26
182 26 -2...

result:

ok Correct. (1 test case)

Test #16:

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

input:

999 999 1

output:

Yes
998
998 2 1 -1
996 4 3 -3
997 3 2 -2
992 8 7 -7
993 7 6 -6
994 6 5 -5
995 5 4 -4
984 16 15 -15
985 15 14 -14
986 14 13 -13
987 13 12 -12
988 12 11 -11
989 11 10 -10
990 10 9 -9
991 9 8 -8
968 32 31 -31
969 31 30 -30
970 30 29 -29
971 29 28 -28
972 28 27 -27
973 27 26 -26
974 26 25 -25
975 25 24 ...

result:

ok Correct. (1 test case)

Test #17:

score: 0
Accepted
time: 2ms
memory: 3592kb

input:

999 1 969

output:

Yes
998
2 968 -1 1
4 971 -3 -3
3 970 -2 -2
8 975 -7 -7
7 974 -6 -6
6 973 -5 -5
5 972 -4 -4
16 983 -15 -15
15 982 -14 -14
14 981 -13 -13
13 980 -12 -12
12 979 -11 -11
11 978 -10 -10
10 977 -9 -9
9 976 -8 -8
32 999 -31 -31
31 998 -30 -30
30 997 -29 -29
29 996 -28 -28
28 995 -27 -27
27 994 -26 -26
26 9...

result:

ok Correct. (1 test case)

Test #18:

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

input:

999 999 780

output:

Yes
998
998 781 1 -1
996 778 3 3
997 779 2 2
992 774 7 7
993 775 6 6
994 776 5 5
995 777 4 4
984 766 15 15
985 767 14 14
986 768 13 13
987 769 12 12
988 770 11 11
989 771 10 10
990 772 9 9
991 773 8 8
968 750 31 31
969 751 30 30
970 752 29 29
971 753 28 28
972 754 27 27
973 755 26 26
974 756 25 25
9...

result:

ok Correct. (1 test case)

Test #19:

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

input:

999 1 999

output:

Yes
998
2 998 -1 1
4 996 -3 3
3 997 -2 2
8 992 -7 7
7 993 -6 6
6 994 -5 5
5 995 -4 4
16 984 -15 15
15 985 -14 14
14 986 -13 13
13 987 -12 12
12 988 -11 11
11 989 -10 10
10 990 -9 9
9 991 -8 8
32 968 -31 31
31 969 -30 30
30 970 -29 29
29 971 -28 28
28 972 -27 27
27 973 -26 26
26 974 -25 25
25 975 -24...

result:

ok Correct. (1 test case)

Test #20:

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

input:

999 686 999

output:

Yes
998
687 998 -1 1
684 996 3 3
685 997 2 2
680 992 7 7
681 993 6 6
682 994 5 5
683 995 4 4
672 984 15 15
673 985 14 14
674 986 13 13
675 987 12 12
676 988 11 11
677 989 10 10
678 990 9 9
679 991 8 8
656 968 31 31
657 969 30 30
658 970 29 29
659 971 28 28
660 972 27 27
661 973 26 26
662 974 25 25
6...

result:

ok Correct. (1 test case)

Test #21:

score: 0
Accepted
time: 2ms
memory: 3728kb

input:

999 999 999

output:

Yes
998
998 998 1 1
996 996 3 3
997 997 2 2
992 992 7 7
993 993 6 6
994 994 5 5
995 995 4 4
984 984 15 15
985 985 14 14
986 986 13 13
987 987 12 12
988 988 11 11
989 989 10 10
990 990 9 9
991 991 8 8
968 968 31 31
969 969 30 30
970 970 29 29
971 971 28 28
972 972 27 27
973 973 26 26
974 974 25 25
97...

result:

ok Correct. (1 test case)

Test #22:

score: 0
Accepted
time: 2ms
memory: 3728kb

input:

1000 757 728

output:

Yes
999
758 727 -1 1
755 730 3 -3
756 729 2 -2
751 734 7 -7
752 733 6 -6
753 732 5 -5
754 731 4 -4
766 719 -15 15
765 720 -14 14
764 721 -13 13
763 722 -12 12
762 723 -11 11
761 724 -10 10
760 725 -9 9
759 726 -8 8
782 750 -31 -31
781 749 -30 -30
780 748 -29 -29
779 747 -28 -28
778 746 -27 -27
777 7...

result:

ok Correct. (1 test case)

Test #23:

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

input:

1000 132 993

output:

Yes
999
133 994 -1 -1
130 996 3 -3
131 995 2 -2
126 1000 7 -7
127 999 6 -6
128 998 5 -5
129 997 4 -4
141 985 -15 15
140 986 -14 14
139 987 -13 13
138 988 -12 12
137 989 -11 11
136 990 -10 10
135 991 -9 9
134 992 -8 8
157 969 -31 31
156 970 -30 30
155 971 -29 29
154 972 -28 28
153 973 -27 27
152 974 ...

result:

ok Correct. (1 test case)

Test #24:

score: 0
Accepted
time: 2ms
memory: 3588kb

input:

1000 703 499

output:

Yes
999
702 500 1 -1
700 497 3 3
701 498 2 2
696 493 7 7
697 494 6 6
698 495 5 5
699 496 4 4
688 485 15 15
689 486 14 14
690 487 13 13
691 488 12 12
692 489 11 11
693 490 10 10
694 491 9 9
695 492 8 8
719 469 -31 31
718 470 -30 30
717 471 -29 29
716 472 -28 28
715 473 -27 27
714 474 -26 26
713 475 -...

result:

ok Correct. (1 test case)

Test #25:

score: 0
Accepted
time: 2ms
memory: 3668kb

input:

1000 910 298

output:

Yes
999
909 299 1 -1
907 301 3 -3
908 300 2 -2
914 305 -7 -7
913 304 -6 -6
912 303 -5 -5
911 302 -4 -4
922 313 -15 -15
921 312 -14 -14
920 311 -13 -13
919 310 -12 -12
918 309 -11 -11
917 308 -10 -10
916 307 -9 -9
915 306 -8 -8
938 282 -31 31
937 283 -30 30
936 284 -29 29
935 285 -28 28
934 286 -27 2...

result:

ok Correct. (1 test case)

Test #26:

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

input:

1000 171 322

output:

Yes
999
172 321 -1 1
169 324 3 -3
170 323 2 -2
165 328 7 -7
166 327 6 -6
167 326 5 -5
168 325 4 -4
157 313 15 15
158 314 14 14
159 315 13 13
160 316 12 12
161 317 11 11
162 318 10 10
163 319 9 9
164 320 8 8
188 344 -31 -31
187 343 -30 -30
186 342 -29 -29
185 341 -28 -28
184 340 -27 -27
183 339 -26 -...

result:

ok Correct. (1 test case)

Test #27:

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

input:

1000 1 1

output:

Yes
999
2 2 -1 -1
4 4 -3 -3
3 3 -2 -2
8 8 -7 -7
7 7 -6 -6
6 6 -5 -5
5 5 -4 -4
16 16 -15 -15
15 15 -14 -14
14 14 -13 -13
13 13 -12 -12
12 12 -11 -11
11 11 -10 -10
10 10 -9 -9
9 9 -8 -8
32 32 -31 -31
31 31 -30 -30
30 30 -29 -29
29 29 -28 -28
28 28 -27 -27
27 27 -26 -26
26 26 -25 -25
25 25 -24 -24
24 2...

result:

ok Correct. (1 test case)

Test #28:

score: 0
Accepted
time: 2ms
memory: 3668kb

input:

1000 480 1

output:

Yes
999
479 2 1 -1
477 4 3 -3
478 3 2 -2
484 8 -7 -7
483 7 -6 -6
482 6 -5 -5
481 5 -4 -4
469 16 15 -15
470 15 14 -14
471 14 13 -13
472 13 12 -12
473 12 11 -11
474 11 10 -10
475 10 9 -9
476 9 8 -8
500 32 -31 -31
499 31 -30 -30
498 30 -29 -29
497 29 -28 -28
496 28 -27 -27
495 27 -26 -26
494 26 -25 -25...

result:

ok Correct. (1 test case)

Test #29:

score: 0
Accepted
time: 2ms
memory: 3644kb

input:

1000 1000 1

output:

Yes
999
999 2 1 -1
997 4 3 -3
998 3 2 -2
993 8 7 -7
994 7 6 -6
995 6 5 -5
996 5 4 -4
985 16 15 -15
986 15 14 -14
987 14 13 -13
988 13 12 -12
989 12 11 -11
990 11 10 -10
991 10 9 -9
992 9 8 -8
969 32 31 -31
970 31 30 -30
971 30 29 -29
972 29 28 -28
973 28 27 -27
974 27 26 -26
975 26 25 -25
976 25 24 ...

result:

ok Correct. (1 test case)

Test #30:

score: 0
Accepted
time: 2ms
memory: 3604kb

input:

1000 1 339

output:

Yes
999
2 340 -1 -1
4 337 -3 3
3 338 -2 2
8 344 -7 -7
7 343 -6 -6
6 342 -5 -5
5 341 -4 -4
16 329 -15 15
15 330 -14 14
14 331 -13 13
13 332 -12 12
12 333 -11 11
11 334 -10 10
10 335 -9 9
9 336 -8 8
32 313 -31 31
31 314 -30 30
30 315 -29 29
29 316 -28 28
28 317 -27 27
27 318 -26 26
26 319 -25 25
25 32...

result:

ok Correct. (1 test case)

Test #31:

score: 0
Accepted
time: 2ms
memory: 3604kb

input:

1000 1000 161

output:

Yes
999
999 162 1 -1
997 164 3 -3
998 163 2 -2
993 157 7 7
994 158 6 6
995 159 5 5
996 160 4 4
985 172 15 -15
986 171 14 -14
987 170 13 -13
988 169 12 -12
989 168 11 -11
990 167 10 -10
991 166 9 -9
992 165 8 -8
969 188 31 -31
970 187 30 -30
971 186 29 -29
972 185 28 -28
973 184 27 -27
974 183 26 -26...

result:

ok Correct. (1 test case)

Test #32:

score: 0
Accepted
time: 2ms
memory: 3596kb

input:

1000 1 1000

output:

Yes
999
2 999 -1 1
4 997 -3 3
3 998 -2 2
8 993 -7 7
7 994 -6 6
6 995 -5 5
5 996 -4 4
16 985 -15 15
15 986 -14 14
14 987 -13 13
13 988 -12 12
12 989 -11 11
11 990 -10 10
10 991 -9 9
9 992 -8 8
32 969 -31 31
31 970 -30 30
30 971 -29 29
29 972 -28 28
28 973 -27 27
27 974 -26 26
26 975 -25 25
25 976 -24...

result:

ok Correct. (1 test case)

Test #33:

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

input:

1000 759 1000

output:

Yes
999
760 999 -1 1
762 997 -3 3
761 998 -2 2
766 993 -7 7
765 994 -6 6
764 995 -5 5
763 996 -4 4
751 985 15 15
752 986 14 14
753 987 13 13
754 988 12 12
755 989 11 11
756 990 10 10
757 991 9 9
758 992 8 8
782 969 -31 31
781 970 -30 30
780 971 -29 29
779 972 -28 28
778 973 -27 27
777 974 -26 26
776...

result:

ok Correct. (1 test case)

Test #34:

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

input:

1000 1000 1000

output:

Yes
999
999 999 1 1
997 997 3 3
998 998 2 2
993 993 7 7
994 994 6 6
995 995 5 5
996 996 4 4
985 985 15 15
986 986 14 14
987 987 13 13
988 988 12 12
989 989 11 11
990 990 10 10
991 991 9 9
992 992 8 8
969 969 31 31
970 970 30 30
971 971 29 29
972 972 28 28
973 973 27 27
974 974 26 26
975 975 25 25
97...

result:

ok Correct. (1 test case)

Test #35:

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

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

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

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

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

input:

810 114 514

output:

Yes
809
113 513 1 1
111 516 3 -3
112 515 2 -2
108 519 6 -6
109 518 5 -5
110 517 4 -4
102 507 12 12
103 508 11 11
104 509 10 10
105 510 9 9
106 511 8 8
107 512 7 7
127 532 -25 -25
126 531 -24 -24
125 530 -23 -23
124 529 -22 -22
123 528 -21 -21
122 527 -20 -20
121 526 -19 -19
120 525 -18 -18
119 524 -...

result:

ok Correct. (1 test case)

Test #40:

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

input:

810 514 114

output:

Yes
809
513 113 1 1
516 111 -3 3
515 112 -2 2
519 108 -6 6
518 109 -5 5
517 110 -4 4
507 102 12 12
508 103 11 11
509 104 10 10
510 105 9 9
511 106 8 8
512 107 7 7
532 127 -25 -25
531 126 -24 -24
530 125 -23 -23
529 124 -22 -22
528 123 -21 -21
527 122 -20 -20
526 121 -19 -19
525 120 -18 -18
524 119 -...

result:

ok Correct. (1 test case)