QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#697838#6677. Puzzle: SashiganehuzhaoxinWA 0ms3584kbC++232.0kb2024-11-01 15:59:582024-11-01 15:59:59

Judging History

你现在查看的是最新测评结果

  • [2024-11-01 15:59:59]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3584kb
  • [2024-11-01 15:59:58]
  • 提交

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;
}

详细

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)