QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#713168 | #6677. Puzzle: Sashigane | libantian# | RE | 0ms | 0kb | C++17 | 1.2kb | 2024-11-05 18:22:49 | 2024-11-05 18:22:50 |
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define INF 0x3f3f3f3f3f3f3f3f
#define pii pair<int,int>
#define x first
#define y second
#define all(_a) _a.begin(), _a.end()
#define rep(i,p,q) for (int i=(p);i<=(q);i++)
#define pre(i,p,q) for (int i=(p);i>=(q);i--)
const int N=100010; struct node{int x,y,p,q;}a[N];
void solve(){
int n,x,y,t=0,p=0;
scanf("%d%d%d",&n,&x,&y);
if (x==y) {
rep(i,1,x-1) a[++t]={i,i,n-1-p,n-1-p},p++;
pre(i,n,y+1) a[++t]={i,i,-(n-1-p),-(n-1-p)},p++;
}
if (x<y) {
rep(i,1,x-1) a[++t]={i,i,n-1-p,n-1-p},p++;
pre(i,n,y+1) a[++t]={i,i,-(n-1-p),-(n-1-p)},p++;
int x0=y,y0=x;
rep(i,x,y-1) a[++t]={x0,y0,-(n-1-p),n-1-p},x0--,y0++,p++;
}
if (x>y) {
rep(i,1,y-1) a[++t]={i,i,n-1-p,n-1-p},p++;
pre(i,n,x+1) a[++t]={i,i,-(n-1-p),-(n-1-p)},p++;
int x0=y,y0=x;
rep(i,y,x-1) a[++t]={x0,y0,n-1-p,-(n-1-p)},x0++,y0--,p++;
}
printf("Yes\n%d\n",t);
rep(i,1,t) printf("%d %d %d %d\n",a[i].x,a[i].y,a[i].p,a[i].q);
}
signed main(){
int T;
T=1;
//cin>>T;
while(T--)solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Runtime Error
input:
5 3 4