QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#676690 | #6677. Puzzle: Sashigane | Anon_chan# | WA | 1ms | 3696kb | C++20 | 1.2kb | 2024-10-25 23:11:08 | 2024-10-25 23:11:08 |
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<<cnt<<endl;
for(ll i=1;i<=cnt;++i){
cout<<r[i]<<' '<<cc[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;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3696kb
input:
5 3 4
output:
3 1 5 -2 2 5 1 4 -4 4 2 3 -3
result:
wrong answer YES or NO expected in answer, but 3 found. (test case 1)