QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#676693 | #6677. Puzzle: Sashigane | Anon_chan# | WA | 1ms | 3640kb | C++20 | 1.3kb | 2024-10-25 23:13:11 | 2024-10-25 23:13:11 |
Judging History
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>midx;--i){
r[++cnt]=x+(Len-i);
cc[cnt]=y+(Len-i);
h[cnt]=i-1;
w[cnt]=i-1;
}
}
}
void solve(void){
cin>>n>>X>>Y;
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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3640kb
input:
5 3 4
output:
Yes 3 5 1 -2 2 1 5 4 -4 2 4 3 -3
result:
wrong answer position (3,4) covered twice. (test case 1)