QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#697838 | #6677. Puzzle: Sashigane | huzhaoxin | WA | 0ms | 3584kb | C++23 | 2.0kb | 2024-11-01 15:59:58 | 2024-11-01 15:59:59 |
Judging History
answer
/*
*****************************
* 作者:huzhaoxin *
* 努力加油,努力赚钱娶媳妇回家 *
* 时时刻刻爱老婆 *
*****************************
*/
#include<bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const double eps = 1e-9;
const long long mod = 1e9 + 7;
const long long inf = 2e12 + 7;
/*---------------------------------------------------------------------------*/
struct str{
ll a,b,c,d;
};
void solve() {
ll n,x,y;
cin>>n>>x>>y;
ll sum=n*n-1;
pll a={1,1},b={1,n},c={n,1},d={n,n};
cout<<"Yes"<<endl;
vector<str>res;
while(sum){
if(a.first!=x&&a.second!=y){
res.push_back({a.first,a.second,c.first-a.first+1,b.second-a.second+1});
sum-=c.first-a.first;
sum-=b.second-a.second;
sum--;
a.first++;
a.second++;
b.first++;
c.second++;
}
else if(b.first!=x&&b.second!=y){
res.push_back({b.first,b.second,d.first-b.first+1,a.second-b.second-1});
sum-=abs(d.first-b.first);
sum-=abs(a.second-b.second);
sum--;
b.first++;
b.second--;
a.first++;
d.second--;
}
else if(c.first!=x&&c.second!=y){
res.push_back({c.first,c.second,a.first-c.first-1,d.second-c.second+1});
sum-=abs(a.first-c.first);
sum-=abs(d.second-c.second);
sum--;
c.first--;
c.second++;
d.first--;
a.second++;
}
else if(d.first!=x&&d.second!=y){
res.push_back({d.first,d.second,b.first-d.first-1,c.second-d.second-1});
sum-=abs(b.first-d.first);
sum-=abs(c.second-d.second);
sum--;
d.first--;
d.second--;
c.first--;
b.second--;
}
}
cout<<res.size()<<endl;
for(auto it:res){
cout<<it.a<<" "<<it.b<<" "<<it.c<<" "<<it.d<<endl;
}
}
/*---------------------------------------------------------------------------*/
int main() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
ll T;
// for (cin >> T; T; T--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3584kb
input:
5 3 4
output:
Yes 4 1 1 5 5 2 2 4 4 5 3 -3 3 4 5 -2 -2
result:
wrong answer L shape #1 out of bounds. (test case 1)