QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#626050 | #6677. Puzzle: Sashigane | Bulonte | WA | 1ms | 3716kb | C++20 | 2.5kb | 2024-10-09 22:43:54 | 2024-10-09 22:43:55 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
struct NODE
{
int r, c, h, w;
};
vector<NODE> ans;
void solve()
{
int n, x, y;
cin >> n >> x >> y;
int len = 0;
int MAX = 0, MIN = 0x3f3f3f;
for (int i = 1; x + i <= n && y + i <= n; i++)
{
int r = x + i, c = y + i;
len++;
//cout << r << " " << c << " " << -len << " " << -len << endl;
ans.push_back({r, c, -len, -len});//ans.size
if (x + i == n || y + i == n)
{
if (x + i == n && y + i != n)
{
MAX = y + i;
}
else if (x + i != n && y + i == n)
{
MAX = x + i;
}
else
{
MAX = -1;
}
}
}
for (int j = 1; x - j >= 1 && y - j >= 1; j++)
{
int r = x - j, c = y - j;
len++;
//cout << r << " " << c << " " << len << " " << len << endl;
ans.push_back({r, c, len, len});
if (x - j == 1 || y - j == 1)
{
if (x - j == 1 && y - j != 1)
{
MIN = y - j;
}
else if (x - j != 1 && y - j == 1)
{
MIN = x - j;
}
else
{
MIN = -1;
}
}
}
if (MAX > 0 && MIN > 0)
{
for (int i = 1; MAX + i <= n && MIN - i >= 1; i++)
{
int r = MAX + i, c = MIN - i;
len++;
//cout << r << " " << c << " ";
if (r > x && c > y)
{
//cout << -len << " " << -len << endl;
ans.push_back({r, c, -len, -len});
}
else if(r > x && c < y)
{
//cout << -len << " " << len << endl;
ans.push_back({r, c, -len, len});
}
else if(r < x && c > y)
{
//cout << len << " " << -len << endl;
ans.push_back({r, c, len, -len});
}
else
{
cout << len << " " << len << endl;
ans.push_back({r, c, len, len});
}
}
}
cout << "Yes" << endl;
cout << ans.size() << endl;
for (int i = 0; i < ans.size();i++)
{
cout << ans[i].r << " " << ans[i].c << " " << ans[i].h << " " << ans[i].w << endl;
}
}
int main()
{
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3636kb
input:
5 3 4
output:
Yes 4 4 5 -1 -1 2 3 2 2 1 2 3 3 5 1 -4 4
result:
ok Correct. (1 test case)
Test #2:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
1 1 1
output:
Yes 0
result:
ok Correct. (1 test case)
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3716kb
input:
3 2 3
output:
Yes 1 1 2 1 1
result:
wrong answer At least one cell is left uncovered. (test case 1)