QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#399120#6677. Puzzle: SashiganexiaoleWA 1ms3672kbC++232.0kb2024-04-25 22:16:582024-04-25 22:16:58

Judging History

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

  • [2024-04-25 22:16:58]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3672kb
  • [2024-04-25 22:16:58]
  • 提交

answer

#include<bits/stdc++.h>
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;using ll = long long;using PLL = pair<ll,ll>;
const ll MAX = 1e18;const ll MIN = -1e18;const ll INF=0x3f3f3f3f;
const ll Q = 2e5+9;const ll MOD = 1e9 + 7;
ll a[105][105];ll n,x,y;ll cnt;
struct edge
{
	ll a,b,c,d;
};

vector<edge> ans;
void zs(){
	for (ll i = 1; i < x; i++)
	{
		for (ll j = 1; j < y; j++)
		{
			if(a[i][j]==0 and a[i+1][j]==0 and a[i][j+1]==0){
				for (ll k = i; k <= i+cnt; k++)
				{
					a[k][j]=1;
				}
				for (ll k = j; k <= j+cnt; k++)
				{
					a[i][k]=1;
				}
				ans.push_back({i,j,cnt,cnt});
				cnt--;
			}
		}
		
	}
	
}
void ys(){
	for (ll i = 1; i < x; i++)
	{
		for (ll j = n; j > y; j--)
		{
			if(a[i][j]==0 and a[i+1][j]==0 and a[i][j-1]==0){
				for (ll k = i-cnt; k <= i; k++)
				{
					a[k][j]=1;
				}
				for (ll k = j; k <= j+cnt; k++)
				{
					a[i][k]=1;
				}
				ans.push_back({i,j,cnt,-cnt});
				cnt--;
			}
		}
		
	}
	
}
void yx(){
	for (ll i = n; i > x; i--)
	{
		for (ll j = n; j > y; j--)
		{
			if(a[i][j]==0 and a[i-1][j]==0 and a[i][j-1]==0){
				for (ll k = i-cnt; k <= i; k++)
				{
					a[k][j]=1;
				}
				for (ll k = j-cnt; k <= j; k++)
				{
					a[i][k]=1;
				}
				ans.push_back({i,j,-cnt,-cnt});
				cnt--;
			}
		}
		
	}
	
}

void zx(){
	for (ll i = n; i > x; i--)
	{
		for (ll j = 1; j < y; j++)
		{
			if(a[i][j]==0 and a[i-1][j]==0 and a[i][j+1]==0){
				for (ll k = i-cnt; k <= i; k++)
				{
					a[k][j]=1;
				}
				for (ll k = j; k <= j+cnt; k++)
				{
					a[i][k]=1;
				}
				ans.push_back({i,j,-cnt,cnt});
				cnt--;
			}
		}
		
	}
	
}
void solve(){
   cin>>n>>x>>y;cnt=n-1;
   cout<<"Yes\n";
   zs();ys();yx();zx();
   cout<<ans.size()<<"\n";
   for(auto [a1,a2,a3,a4]:ans){
		cout<<a1<<" "<<a2<<" "<<a3<<" "<<a4<<"\n";
   }
}
int main(){
	ios;ll _=1;//cin>>_;
	while (_--)solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3652kb

input:

5 3 4

output:

Yes
4
1 1 4 4
2 2 3 3
5 5 -2 -2
4 3 -1 1

result:

ok Correct. (1 test case)

Test #2:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

1 1 1

output:

Yes
0

result:

ok Correct. (1 test case)

Test #3:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

3 2 3

output:

Yes
2
1 1 2 2
3 2 -1 1

result:

ok Correct. (1 test case)

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3672kb

input:

10 10 5

output:

Yes
29
1 1 9 9
2 2 8 8
3 3 7 7
4 4 6 6
5 10 5 -5
5 9 4 -4
5 8 3 -3
5 7 2 -2
5 6 1 -1
6 10 0 0
6 9 -1 1
6 8 -2 2
6 7 -3 3
6 6 -4 4
7 10 -5 5
7 9 -6 6
7 8 -7 7
7 7 -8 8
7 6 -9 9
8 10 -10 10
8 9 -11 11
8 8 -12 12
8 7 -13 13
8 6 -14 14
9 10 -15 15
9 9 -16 16
9 8 -17 17
9 7 -18 18
9 6 -19 19

result:

wrong answer position (5,9) covered twice. (test case 1)