QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#712518 | #6677. Puzzle: Sashigane | wsyear# | WA | 0ms | 3592kb | C++20 | 1.5kb | 2024-11-05 15:59:25 | 2024-11-05 15:59:26 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i, j, k) for (int i = (j); i <= (k); ++i)
#define per(i, j, k) for (int i = (j); i >= (k); --i)
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
using ll = long long;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
template<class T>inline void chkmn(T &x, T y) { if (y < x) x = y; }
template<class T>inline void chkmx(T &x, T y) { if (y > x) x = y; }
using namespace std;
vector<tuple<int, int, int, int>> ans;
int n, x, y;
int main() {
cin.tie(nullptr) -> ios::sync_with_stdio(false);
cin >> n >> x >> y;
int xl = x, xr = x, yl = y, yr = y;
while (xl > 1 || xr < n|| yl > 1 || yr < n) {
// cerr << xl << " " << xr << " " << yl << " " << yr << endl;
if (xl - 1 > n - xr && yl - 1 > n - yr) {
ans.emplace_back(xl - 1, yl - 1, xr - xl + 1, yr - yl + 1);
xl--, yl--;
} else if (xl - 1 > n - xr && yl - 1 <= n - yr) {
ans.emplace_back(xl - 1, yr + 1, xr - xl + 1, -(yr - yl + 1));
xl--, yr++;
} else if (xl - 1 <= n - xr && yl - 1 > n - yr) {
ans.emplace_back(xr + 1, yl - 1, -(xr - xl + 1), yr - yl + 1);
xr++, yl--;
} else if (xl - 1 <= n - xr && yl - 1 <= n - yr) {
ans.emplace_back(xr + 1, yl + 1, -(xr - xl + 1), -(yr - yl + 1));
xr++, yr++;
}
}
cout << "Yes\n";
cout << SZ(ans) << '\n';
for (auto [a, b, c, d] : ans) cout << a << " " << b << " " << c << " " << d << '\n';
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3592kb
input:
5 3 4
output:
Yes 4 4 3 -1 1 2 2 2 2 5 3 -3 -3 1 1 4 4
result:
wrong answer L shape #3 out of bounds. (test case 1)