QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#142166 | #6677. Puzzle: Sashigane | VIOLET__FOREVER | WA | 1ms | 3464kb | C++14 | 1.0kb | 2023-08-18 16:15:57 | 2023-08-18 16:16:57 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,sx,sy;
void dfs(int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4,int num){
if(num>n){
exit(0);
}
else{
int xx=x1-1,yy=y1-1;
if(xx>=1 && yy>=1 && xx<=n && yy<=n){
cout<<xx<<" "<<yy<<" "<<num<<" "<<num<<endl;
dfs(xx,yy,x2,y2-1,x3-1,y3,x4,y4,num+1);
return ;
}
xx=x2+1,yy=y2-1;
if(xx>=1 && yy>=1 && xx<=n && yy<=n){
cout<<xx<<" "<<yy<<" "<<num*-1<<" "<<num<<endl;
dfs(x1,y1-1,xx,yy,x3,y3,x4+1,y4,num+1);
return ;
}
xx=x3-1,yy=y3+1;
if(xx>=1 && yy>=1 && xx<=n && yy<=n){
cout<<xx<<" "<<yy<<" "<<num<<" "<<num*-1<<endl;
dfs(x1-1,y1,x2,y2,xx,yy,x4,y4+1,num+1);
return ;
}
xx=x4+1,yy=y4+1;
if(xx>=1 && yy>=1 && xx<=n && yy<=n){
cout<<xx<<" "<<yy<<" "<<num*-1<<" "<<num*-1<<endl;
dfs(x1,y1,x2+1,y2,x3,y3+1,xx,yy,num+1);
}
}
}
signed main(){
cin>>n>>sx>>sy;
cout<<"Yes"<<endl;
cout<<n-1<<endl;
if(n==1) puts("0");
else dfs(sx,sy,sx,sy,sx,sy,sx,sy,1);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3448kb
input:
5 3 4
output:
Yes 4 2 3 1 1 1 2 2 2 4 1 -3 3 5 5 -4 -4
result:
ok Correct. (1 test case)
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3464kb
input:
1 1 1
output:
Yes 0 0
result:
wrong output format Expected EOF (test case 1)