QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#416549 | #6677. Puzzle: Sashigane | XiaoretaW | WA | 1ms | 3784kb | C++20 | 1.7kb | 2024-05-21 22:43:26 | 2024-05-21 22:43:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define all(a) a.begin(), a.end()
#define rep(i, l, r) for (int i = l; i < r; ++i)
#define per(i, r, l) for (int i = r-1; i >= l; --i)
typedef long long ll;
typedef pair<int, int> PI;
template<typename T> bool setmax(T &a, T b) { return (a < b ? a = b, 1 : 0); }
template<typename T> bool setmin(T &a, T b) { return (a > b ? a = b, 1 : 0); }
int main() {
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n, x, y; cin >> n >> x >> y;
vector<array<int, 4>> ans;
vector<int> gone(n + 1);
gone[y] = 1;
int d = 1;
// you shang
while (x - d > 0 && y + d <= n) {
gone[y + d] = 1;
ans.push_back({x - d, y + d, d, -d});
++d;
}
int dd = 1;
while (x + dd <= n && y - dd > 0) {
gone[y - dd] = 1;
ans.push_back({x + dd, y - dd, -d, d});
++dd;
++d;
}
int cury = 0;
for (int i = n; i >= 1; i--) if (!gone[i]) {
cury = i;
break;
}
// cout << cury << ' ' << d << ' ' << n << '\n';
if (cury + d > n) {
while (cury != 0 && cury <= n) {
ans.push_back({cury, cury, -d, -d});
++d;
++cury;
}
} else {
while (cury > 0 && n != 1) {
ans.push_back({cury, cury, d, d});
++d;
--cury;
}
}
cout << "Yes\n";
cout << sz(ans) << '\n';
for (auto [r, c, h, w] : ans) cout << r << ' ' << c << ' ' << h << ' ' << w << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3488kb
input:
5 3 4
output:
Yes 4 2 5 1 -1 4 3 -2 2 5 2 -3 3 1 1 4 4
result:
ok Correct. (1 test case)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3476kb
input:
1 1 1
output:
Yes 0
result:
ok Correct. (1 test case)
Test #3:
score: 0
Accepted
time: 1ms
memory: 3528kb
input:
3 2 3
output:
Yes 2 3 2 -1 1 1 1 2 2
result:
ok Correct. (1 test case)
Test #4:
score: 0
Accepted
time: 1ms
memory: 3496kb
input:
10 10 5
output:
Yes 9 9 6 1 -1 8 7 2 -2 7 8 3 -3 6 9 4 -4 5 10 5 -5 4 4 6 6 3 3 7 7 2 2 8 8 1 1 9 9
result:
ok Correct. (1 test case)
Test #5:
score: 0
Accepted
time: 1ms
memory: 3444kb
input:
10 5 7
output:
Yes 9 4 8 1 -1 3 9 2 -2 2 10 3 -3 6 6 -4 4 7 5 -5 5 8 4 -6 6 9 3 -7 7 10 2 -8 8 1 1 9 9
result:
ok Correct. (1 test case)
Test #6:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
10 9 2
output:
Yes 9 8 3 1 -1 7 4 2 -2 6 5 3 -3 5 6 4 -4 4 7 5 -5 3 8 6 -6 2 9 7 -7 1 10 8 -8 10 1 -9 9
result:
ok Correct. (1 test case)
Test #7:
score: 0
Accepted
time: 1ms
memory: 3420kb
input:
10 6 10
output:
Yes 9 7 9 -1 1 8 8 -2 2 9 7 -3 3 10 6 -4 4 5 5 5 5 4 4 6 6 3 3 7 7 2 2 8 8 1 1 9 9
result:
ok Correct. (1 test case)
Test #8:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
10 8 4
output:
Yes 9 7 5 1 -1 6 6 2 -2 5 7 3 -3 4 8 4 -4 3 9 5 -5 2 10 6 -6 9 3 -7 7 10 2 -8 8 1 1 9 9
result:
ok Correct. (1 test case)
Test #9:
score: 0
Accepted
time: 1ms
memory: 3740kb
input:
999 396 693
output:
Yes 998 395 694 1 -1 394 695 2 -2 393 696 3 -3 392 697 4 -4 391 698 5 -5 390 699 6 -6 389 700 7 -7 388 701 8 -8 387 702 9 -9 386 703 10 -10 385 704 11 -11 384 705 12 -12 383 706 13 -13 382 707 14 -14 381 708 15 -15 380 709 16 -16 379 710 17 -17 378 711 18 -18 377 712 19 -19 376 713 20 -20 375 714 21...
result:
ok Correct. (1 test case)
Test #10:
score: 0
Accepted
time: 1ms
memory: 3784kb
input:
999 963 827
output:
Yes 998 962 828 1 -1 961 829 2 -2 960 830 3 -3 959 831 4 -4 958 832 5 -5 957 833 6 -6 956 834 7 -7 955 835 8 -8 954 836 9 -9 953 837 10 -10 952 838 11 -11 951 839 12 -12 950 840 13 -13 949 841 14 -14 948 842 15 -15 947 843 16 -16 946 844 17 -17 945 845 18 -18 944 846 19 -19 943 847 20 -20 942 848 21...
result:
ok Correct. (1 test case)
Test #11:
score: 0
Accepted
time: 1ms
memory: 3740kb
input:
999 871 185
output:
Yes 998 870 186 1 -1 869 187 2 -2 868 188 3 -3 867 189 4 -4 866 190 5 -5 865 191 6 -6 864 192 7 -7 863 193 8 -8 862 194 9 -9 861 195 10 -10 860 196 11 -11 859 197 12 -12 858 198 13 -13 857 199 14 -14 856 200 15 -15 855 201 16 -16 854 202 17 -17 853 203 18 -18 852 204 19 -19 851 205 20 -20 850 206 21...
result:
ok Correct. (1 test case)
Test #12:
score: 0
Accepted
time: 1ms
memory: 3552kb
input:
999 787 812
output:
Yes 998 786 813 1 -1 785 814 2 -2 784 815 3 -3 783 816 4 -4 782 817 5 -5 781 818 6 -6 780 819 7 -7 779 820 8 -8 778 821 9 -9 777 822 10 -10 776 823 11 -11 775 824 12 -12 774 825 13 -13 773 826 14 -14 772 827 15 -15 771 828 16 -16 770 829 17 -17 769 830 18 -18 768 831 19 -19 767 832 20 -20 766 833 21...
result:
ok Correct. (1 test case)
Test #13:
score: -100
Wrong Answer
time: 1ms
memory: 3544kb
input:
999 396 199
output:
Yes 594 395 200 1 -1 394 201 2 -2 393 202 3 -3 392 203 4 -4 391 204 5 -5 390 205 6 -6 389 206 7 -7 388 207 8 -8 387 208 9 -9 386 209 10 -10 385 210 11 -11 384 211 12 -12 383 212 13 -13 382 213 14 -14 381 214 15 -15 380 215 16 -16 379 216 17 -17 378 217 18 -18 377 218 19 -19 376 219 20 -20 375 220 21...
result:
wrong answer At least one cell is left uncovered. (test case 1)