QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#260234 | #6677. Puzzle: Sashigane | learn_cute | WA | 0ms | 3380kb | C++14 | 1.3kb | 2023-11-21 22:41:22 | 2023-11-21 22:41:23 |
Judging History
answer
#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
using namespace std;
using LL = long long;
using PII = pair<int, int>;
const int N = 1e5+10;
int n, X, Y;
struct Ans {
int x1, y1, x2, y2;
};
vector<Ans> ans;
void dfs(int x1, int y1, int x2, int y2) {
int d = x2 - x1;
if (!d) return;
if (x1 != X && y1 != Y) {
dfs(x1 + 1, y1 + 1, x2, y2);
ans.pb({x1, y1, d, d});
}
else if (x1 != X && y2 != Y) {
dfs(x1 + 1, y1, x2, y2 - 1);
ans.pb({x1, y2, d, -d});
}
else if (x2 != X && y1 != Y) {
dfs(x1, y1 + 1, x2 - 1, y2);
ans.pb({x2, y1, -d, d});
}
else if (x2 != X && y2 != Y) {
dfs(x1, y1, x2 - 1, y2 - 1);
ans.pb({x2, y2, -d, -d});
}
}
int main() {
#ifdef ONLINE_JUDGE
#else
freopen("D:\\VSCODE\\CPP\\codeforces\\test\\in.txt","r",stdin);
freopen("D:\\VSCODE\\CPP\\codeforces\\test\\out.txt","w",stdout);
#endif
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> n >> X >> Y;
cout << "Yes\n";
dfs(1, 1, n, n);
for (auto [r, c, h, w] : ans) {
cout << r << ' ';
cout << c << ' ';
cout << h << ' ';
cout << w << '\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3380kb
input:
5 3 4
output:
Yes 4 5 -1 -1 5 3 -2 2 2 2 3 3 1 1 4 4
result:
wrong answer Integer parameter [name=c] equals to -1, violates the range [1, 5] (test case 1)