QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#212765#6677. Puzzle: SashiganeS_Explosion#AC ✓1ms3988kbC++202.5kb2023-10-13 20:25:412023-10-13 20:25:41

Judging History

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

  • [2023-10-13 20:25:41]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3988kb
  • [2023-10-13 20:25:41]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

const int N=1000005;

int n,m,bx,by,len,cnt;
struct node{
    int r,c,h,w;
}ans[N];
inline int read(){
    int ret=0,ff=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')ff=-1;ch=getchar();}
    while(isdigit(ch)){ret=ret*10+(ch^48);ch=getchar();}
    return ret*ff;
}
int in(int x,int y,int len){
    if(bx>=x&&bx<=x+len-1&&by>=y&&by<=y+len-1) return 1;
    return 0;
}
void add(int sx,int sy,int ex,int ey,int l,int dr){
    if(dr==1){
        int tx=sx,ty=sy,tl=l;
        while(tx<=ex){
            ans[++cnt]=(node){tx,ty,-l,-l};
            l++;
            tx++,ty++;
        }
    }
    if(dr==2){
        int tx=sx,ty=sy,tl=l;
        while(tx<=ex){
            ans[++cnt]=(node){tx,ty,-l,l};
            l++;
            tx++,ty--;
        }
    }
    if(dr==3){
        int tx=sx,ty=sy,tl=l;
        while(tx>=ex){
            ans[++cnt]=(node){tx,ty,l,l};
            l++;
            tx--,ty--;
        }
    }
    if(dr==4){
        int tx=sx,ty=sy,tl=l;
        while(tx>=ex){
            ans[++cnt]=(node){tx,ty,l,-l};
            l++;
            tx--,ty++;
        }
    }
}
void solve(int x,int y,int l){
    if(l==1) return;
    int tl=l/2;
    if(in(x,y,tl)){
        add(x+tl,y+tl,x+l-1,y+l-1,tl,1);
        solve(x,y,tl);
    }
    if(in(x,y+tl,tl)){
        add(x+tl,y+tl-1,x+l-1,y,tl,2);
        solve(x,y+tl,tl);
    }
    if(in(x+tl,y+tl,tl)){
        add(x+tl-1,y+tl-1,x,y,tl,3);
        solve(x+tl,y+tl,tl);
    }
    if(in(x+tl,y,tl)){
        add(x+tl-1,y+tl,x,y+l-1,tl,4);
        solve(x+tl,y,tl);
    }
}
void print(){
    printf("%d\n",cnt);
    for(int i=1;i<=cnt;i++){
        printf("%d %d %d %d\n",ans[i].r,ans[i].c,ans[i].h,ans[i].w);
    }
}
int main(){
    n=read(),bx=read(),by=read();
    puts("Yes");
    if(n==1){
        printf("0");
        return 0;
    }
    m=1;
    while((1<<m)<=n) m++;
    m--;
    len=(1<<m);
    if(in(1,1,len)){
        add(1+len,1+len,n,n,len,1);
        solve(1,1,len);
        print();
        return 0;
    }
    if(in(1,n-len+1,len)){
        add(1+len,n-len,n,1,len,2);
        solve(1,n-len+1,len);
        print();
        return 0;
    }
    if(in(n-len+1,n-len+1,len)){
        add(n-len,n-len,1,1,len,3);
        solve(n-len+1,n-len+1,len);
        print();
        return 0;
    }
    if(in(n-len+1,1,len)){
        add(n-len,1+len,1,n,len,4);
        solve(n-len+1,1,len);
        print();
        return 0;
    }
    
    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 3 4

output:

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

result:

ok Correct. (1 test case)

Test #2:

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

input:

1 1 1

output:

Yes
0

result:

ok Correct. (1 test case)

Test #3:

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

input:

3 2 3

output:

Yes
2
3 1 -2 2
1 2 1 1

result:

ok Correct. (1 test case)

Test #4:

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

input:

10 10 5

output:

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

result:

ok Correct. (1 test case)

Test #5:

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

input:

10 5 7

output:

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

result:

ok Correct. (1 test case)

Test #6:

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

input:

10 9 2

output:

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

result:

ok Correct. (1 test case)

Test #7:

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

input:

10 6 10

output:

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

result:

ok Correct. (1 test case)

Test #8:

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

input:

10 8 4

output:

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

result:

ok Correct. (1 test case)

Test #9:

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

input:

999 396 693

output:

Yes
998
513 487 -512 512
514 486 -513 513
515 485 -514 514
516 484 -515 515
517 483 -516 516
518 482 -517 517
519 481 -518 518
520 480 -519 519
521 479 -520 520
522 478 -521 521
523 477 -522 522
524 476 -523 523
525 475 -524 524
526 474 -525 525
527 473 -526 526
528 472 -527 527
529 471 -528 528
530...

result:

ok Correct. (1 test case)

Test #10:

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

input:

999 963 827

output:

Yes
998
487 487 512 512
486 486 513 513
485 485 514 514
484 484 515 515
483 483 516 516
482 482 517 517
481 481 518 518
480 480 519 519
479 479 520 520
478 478 521 521
477 477 522 522
476 476 523 523
475 475 524 524
474 474 525 525
473 473 526 526
472 472 527 527
471 471 528 528
470 470 529 529
469 ...

result:

ok Correct. (1 test case)

Test #11:

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

input:

999 871 185

output:

Yes
998
487 513 512 -512
486 514 513 -513
485 515 514 -514
484 516 515 -515
483 517 516 -516
482 518 517 -517
481 519 518 -518
480 520 519 -519
479 521 520 -520
478 522 521 -521
477 523 522 -522
476 524 523 -523
475 525 524 -524
474 526 525 -525
473 527 526 -526
472 528 527 -527
471 529 528 -528
470...

result:

ok Correct. (1 test case)

Test #12:

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

input:

999 787 812

output:

Yes
998
487 487 512 512
486 486 513 513
485 485 514 514
484 484 515 515
483 483 516 516
482 482 517 517
481 481 518 518
480 480 519 519
479 479 520 520
478 478 521 521
477 477 522 522
476 476 523 523
475 475 524 524
474 474 525 525
473 473 526 526
472 472 527 527
471 471 528 528
470 470 529 529
469 ...

result:

ok Correct. (1 test case)

Test #13:

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

input:

999 396 199

output:

Yes
998
513 513 -512 -512
514 514 -513 -513
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 ...

result:

ok Correct. (1 test case)

Test #14:

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

input:

999 1 1

output:

Yes
998
513 513 -512 -512
514 514 -513 -513
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 ...

result:

ok Correct. (1 test case)

Test #15:

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

input:

999 163 1

output:

Yes
998
513 513 -512 -512
514 514 -513 -513
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 ...

result:

ok Correct. (1 test case)

Test #16:

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

input:

999 999 1

output:

Yes
998
487 513 512 -512
486 514 513 -513
485 515 514 -514
484 516 515 -515
483 517 516 -516
482 518 517 -517
481 519 518 -518
480 520 519 -519
479 521 520 -520
478 522 521 -521
477 523 522 -522
476 524 523 -523
475 525 524 -524
474 526 525 -525
473 527 526 -526
472 528 527 -527
471 529 528 -528
470...

result:

ok Correct. (1 test case)

Test #17:

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

input:

999 1 969

output:

Yes
998
513 487 -512 512
514 486 -513 513
515 485 -514 514
516 484 -515 515
517 483 -516 516
518 482 -517 517
519 481 -518 518
520 480 -519 519
521 479 -520 520
522 478 -521 521
523 477 -522 522
524 476 -523 523
525 475 -524 524
526 474 -525 525
527 473 -526 526
528 472 -527 527
529 471 -528 528
530...

result:

ok Correct. (1 test case)

Test #18:

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

input:

999 999 780

output:

Yes
998
487 487 512 512
486 486 513 513
485 485 514 514
484 484 515 515
483 483 516 516
482 482 517 517
481 481 518 518
480 480 519 519
479 479 520 520
478 478 521 521
477 477 522 522
476 476 523 523
475 475 524 524
474 474 525 525
473 473 526 526
472 472 527 527
471 471 528 528
470 470 529 529
469 ...

result:

ok Correct. (1 test case)

Test #19:

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

input:

999 1 999

output:

Yes
998
513 487 -512 512
514 486 -513 513
515 485 -514 514
516 484 -515 515
517 483 -516 516
518 482 -517 517
519 481 -518 518
520 480 -519 519
521 479 -520 520
522 478 -521 521
523 477 -522 522
524 476 -523 523
525 475 -524 524
526 474 -525 525
527 473 -526 526
528 472 -527 527
529 471 -528 528
530...

result:

ok Correct. (1 test case)

Test #20:

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

input:

999 686 999

output:

Yes
998
487 487 512 512
486 486 513 513
485 485 514 514
484 484 515 515
483 483 516 516
482 482 517 517
481 481 518 518
480 480 519 519
479 479 520 520
478 478 521 521
477 477 522 522
476 476 523 523
475 475 524 524
474 474 525 525
473 473 526 526
472 472 527 527
471 471 528 528
470 470 529 529
469 ...

result:

ok Correct. (1 test case)

Test #21:

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

input:

999 999 999

output:

Yes
998
487 487 512 512
486 486 513 513
485 485 514 514
484 484 515 515
483 483 516 516
482 482 517 517
481 481 518 518
480 480 519 519
479 479 520 520
478 478 521 521
477 477 522 522
476 476 523 523
475 475 524 524
474 474 525 525
473 473 526 526
472 472 527 527
471 471 528 528
470 470 529 529
469 ...

result:

ok Correct. (1 test case)

Test #22:

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

input:

1000 757 728

output:

Yes
999
488 488 512 512
487 487 513 513
486 486 514 514
485 485 515 515
484 484 516 516
483 483 517 517
482 482 518 518
481 481 519 519
480 480 520 520
479 479 521 521
478 478 522 522
477 477 523 523
476 476 524 524
475 475 525 525
474 474 526 526
473 473 527 527
472 472 528 528
471 471 529 529
470 ...

result:

ok Correct. (1 test case)

Test #23:

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

input:

1000 132 993

output:

Yes
999
513 488 -512 512
514 487 -513 513
515 486 -514 514
516 485 -515 515
517 484 -516 516
518 483 -517 517
519 482 -518 518
520 481 -519 519
521 480 -520 520
522 479 -521 521
523 478 -522 522
524 477 -523 523
525 476 -524 524
526 475 -525 525
527 474 -526 526
528 473 -527 527
529 472 -528 528
530...

result:

ok Correct. (1 test case)

Test #24:

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

input:

1000 703 499

output:

Yes
999
488 488 512 512
487 487 513 513
486 486 514 514
485 485 515 515
484 484 516 516
483 483 517 517
482 482 518 518
481 481 519 519
480 480 520 520
479 479 521 521
478 478 522 522
477 477 523 523
476 476 524 524
475 475 525 525
474 474 526 526
473 473 527 527
472 472 528 528
471 471 529 529
470 ...

result:

ok Correct. (1 test case)

Test #25:

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

input:

1000 910 298

output:

Yes
999
488 513 512 -512
487 514 513 -513
486 515 514 -514
485 516 515 -515
484 517 516 -516
483 518 517 -517
482 519 518 -518
481 520 519 -519
480 521 520 -520
479 522 521 -521
478 523 522 -522
477 524 523 -523
476 525 524 -524
475 526 525 -525
474 527 526 -526
473 528 527 -527
472 529 528 -528
471...

result:

ok Correct. (1 test case)

Test #26:

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

input:

1000 171 322

output:

Yes
999
513 513 -512 -512
514 514 -513 -513
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 ...

result:

ok Correct. (1 test case)

Test #27:

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

input:

1000 1 1

output:

Yes
999
513 513 -512 -512
514 514 -513 -513
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 ...

result:

ok Correct. (1 test case)

Test #28:

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

input:

1000 480 1

output:

Yes
999
513 513 -512 -512
514 514 -513 -513
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 ...

result:

ok Correct. (1 test case)

Test #29:

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

input:

1000 1000 1

output:

Yes
999
488 513 512 -512
487 514 513 -513
486 515 514 -514
485 516 515 -515
484 517 516 -516
483 518 517 -517
482 519 518 -518
481 520 519 -519
480 521 520 -520
479 522 521 -521
478 523 522 -522
477 524 523 -523
476 525 524 -524
475 526 525 -525
474 527 526 -526
473 528 527 -527
472 529 528 -528
471...

result:

ok Correct. (1 test case)

Test #30:

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

input:

1000 1 339

output:

Yes
999
513 513 -512 -512
514 514 -513 -513
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 ...

result:

ok Correct. (1 test case)

Test #31:

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

input:

1000 1000 161

output:

Yes
999
488 513 512 -512
487 514 513 -513
486 515 514 -514
485 516 515 -515
484 517 516 -516
483 518 517 -517
482 519 518 -518
481 520 519 -519
480 521 520 -520
479 522 521 -521
478 523 522 -522
477 524 523 -523
476 525 524 -524
475 526 525 -525
474 527 526 -526
473 528 527 -527
472 529 528 -528
471...

result:

ok Correct. (1 test case)

Test #32:

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

input:

1000 1 1000

output:

Yes
999
513 488 -512 512
514 487 -513 513
515 486 -514 514
516 485 -515 515
517 484 -516 516
518 483 -517 517
519 482 -518 518
520 481 -519 519
521 480 -520 520
522 479 -521 521
523 478 -522 522
524 477 -523 523
525 476 -524 524
526 475 -525 525
527 474 -526 526
528 473 -527 527
529 472 -528 528
530...

result:

ok Correct. (1 test case)

Test #33:

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

input:

1000 759 1000

output:

Yes
999
488 488 512 512
487 487 513 513
486 486 514 514
485 485 515 515
484 484 516 516
483 483 517 517
482 482 518 518
481 481 519 519
480 480 520 520
479 479 521 521
478 478 522 522
477 477 523 523
476 476 524 524
475 475 525 525
474 474 526 526
473 473 527 527
472 472 528 528
471 471 529 529
470 ...

result:

ok Correct. (1 test case)

Test #34:

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

input:

1000 1000 1000

output:

Yes
999
488 488 512 512
487 487 513 513
486 486 514 514
485 485 515 515
484 484 516 516
483 483 517 517
482 482 518 518
481 481 519 519
480 480 520 520
479 479 521 521
478 478 522 522
477 477 523 523
476 476 524 524
475 475 525 525
474 474 526 526
473 473 527 527
472 472 528 528
471 471 529 529
470 ...

result:

ok Correct. (1 test case)

Test #35:

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

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

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

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

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

input:

810 114 514

output:

Yes
809
513 298 -512 512
514 297 -513 513
515 296 -514 514
516 295 -515 515
517 294 -516 516
518 293 -517 517
519 292 -518 518
520 291 -519 519
521 290 -520 520
522 289 -521 521
523 288 -522 522
524 287 -523 523
525 286 -524 524
526 285 -525 525
527 284 -526 526
528 283 -527 527
529 282 -528 528
530...

result:

ok Correct. (1 test case)

Test #40:

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

input:

810 514 114

output:

Yes
809
298 513 512 -512
297 514 513 -513
296 515 514 -514
295 516 515 -515
294 517 516 -516
293 518 517 -517
292 519 518 -518
291 520 519 -519
290 521 520 -520
289 522 521 -521
288 523 522 -522
287 524 523 -523
286 525 524 -524
285 526 525 -525
284 527 526 -526
283 528 527 -527
282 529 528 -528
281...

result:

ok Correct. (1 test case)