QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#720725 | #6677. Puzzle: Sashigane | ucup-team5226# | WA | 0ms | 3548kb | C++20 | 3.7kb | 2024-11-07 13:49:01 | 2024-11-07 13:49:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vc<vc<T>>;
template <class T>
using vvvc = vc<vvc<T>>;
#define overload5(a, b, c, d, e, name, ...) name
#define overload4(a, b, c, d, name, ...) name
#define overload3(a, b, c, name, ...) name
#define rep1(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for (ll i = n; i--;)
#define rrep2(i, n) for (ll i = n; i--;)
#define rrep3(i, a, b) for (ll i = b; i-- > (a);)
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define each1(i, a) for (auto &&i : a)
#define each2(x, y, a) for (auto &&[x, y] : a)
#define each3(x, y, z, a) for (auto &&[x, y, z] : a)
#define each4(w, x, y, z, a) for (auto &&[w, x, y, z] : a)
#define each(...) overload5(__VA_ARGS__, each4, each3, each2, each1)(__VA_ARGS__)
#define all1(i) begin(i), end(i)
#define all2(i, a) begin(i), begin(i) + a
#define all3(i, a, b) begin(i) + a, begin(i) + b
#define all(...) overload3(__VA_ARGS__, all3, all2, all1)(__VA_ARGS__)
#define rall1(i) rbegin(i), rend(i)
#define rall2(i, a) rbegin(i), rbegin(i) + a
#define rall3(i, a, b) rbegin(i) + a, rbegin(i) + b
#define rall(...) overload3(__VA_ARGS__, rall3, rall2, rall1)(__VA_ARGS__)
template <class T>
bool chmin(T &a, const T &b) {
if (a <= b) return 0;
a = b;
return 1;
}
template <class T>
bool chmax(T &a, const T &b) {
if (a >= b) return 0;
a = b;
return 1;
}
template <class T, class U>
bool chmin(T &a, const U &b) {
return chmin(a, (T)b);
}
template <class T, class U>
bool chmax(T &a, const U &b) {
return chmax(a, (T)b);
}
void solve();
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(20);
ll t = 1;
// cin >> t;
for (int i = 1; i <= t; i++) solve();
return 0;
}
ll dy[] = {0, 0, 1, 0, -1}, dx[] = {0, 1, 0, -1, 0};
// ll dy[8] = {1, 1, 0, -1, -1, -1, 0, 1}, dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
void solve() {
ll n, h, w;
cin >> n >> h >> w;
struct Item {
ll r, c, h, w;
};
vc<Item> res;
auto dfs = [&](auto &&dfs, ll h1, ll h2, ll w1, ll w2, ll n) -> void {
if (n == 1) return;
if (!(h == h1 or w == w1)) {
Item val;
val.r = h1, val.c = w1;
val.h = n - 1, val.w = n - 1;
res.push_back(val);
dfs(dfs, h1 + 1, h2, w1 + 1, w2, n - 1);
return;
}
if (!(h == h1 or w == w2)) {
Item val;
val.r = h1, val.c = w2;
val.h = n - 1, val.w = n - 1;
res.push_back(val);
dfs(dfs, h1 + 1, h2, w1, w2 - 1, n - 1);
return;
}
if (!(h == h2 or w == w2)) {
Item val;
val.r = h2, val.c = w2;
val.h = n - 1, val.w = n - 1;
res.push_back(val);
dfs(dfs, h1, h2 - 1, w1, w2 - 1, n - 1);
return;
}
if (!(h == h2 or w == w1)) {
Item val;
val.r = h2, val.c = w1;
val.h = n - 1, val.w = n - 1;
res.push_back(val);
dfs(dfs, h1, h2 - 1, w1 + 1, w2, n - 1);
return;
}
};
cout << "Yes" << endl;
dfs(dfs, 1, n, 1, n, n);
cout << res.size() << endl;
for (auto x : res) cout << x.r << " " << x.c << " " << x.h << " " << x.w << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3548kb
input:
5 3 4
output:
Yes 4 1 1 4 4 2 2 3 3 5 5 2 2 4 3 1 1
result:
wrong answer L shape #3 out of bounds. (test case 1)