QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#142122 | #5575. Knight's Tour Redux | ammardab3an# | WA | 1ms | 3516kb | C++17 | 1.6kb | 2023-08-18 15:20:27 | 2023-08-18 15:20:28 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int, int>>v10 = { {1,1},{4,2},{3,5},{2,8},{5,9},{6,6},{7,3},{10,4},{9,7},{8,10} };
vector<pair<int, int>>v8 = { {1,1},{2,4},{3,7},{6,8},{5,5},{4,2},{7,3},{8,6} };
vector<pair<int, int>>v7 = { {1,1},{2,4},{5,5},{6,2},{3,3},{4,6},{7,7} };
vector<pair<int, int>>v6 = { {1,1},{2,4},{5,5},{6,2},{3,3},{4,6} };
if (n == 12 || n == 13) {
int cur = 0;
for (auto x : v6) {
cout << x.first + cur << " " << x.second + cur << '\n';
}
cur = 6;
for (auto x : v6) {
cout << x.first + cur << " " << x.second + cur << '\n';
}
cur = 12;
if (n == 13) {
cout << 13 << " " << 13 << '\n';
}
return 0;
}
for (int i = 0; i < 4; i++) {
if (n < i * 10)break;
int m = (n - i * 10) % 8;
if (!m || m == 1 || m == 7 || m == 6) {
cout << "POSSIBLE\n";
int cur = 0;
for (int j = 0; j < i; j++) {
for (auto x : v10)cout << x.first + cur << " " << x.second + cur << '\n';
cur += 10;
}
n -= 10 * i;
int mm = n / 8;
while (mm--) {
for (auto x : v8) {
cout << x.first + cur << " " << x.second + cur << '\n';
}
n -= 8;
cur += 8;
}
if (m == 1) {
cout << cur + 1 << " " << cur + 1 << '\n';
}
else if (m == 7) {
for (auto x : v7) {
cout << x.first + cur << " " << x.second + cur << '\n';
}
}
else if (m == 6) {
for (auto x : v6) {
cout << x.first + cur << " " << x.second + cur << '\n';
}
}
return 0;
}
}
cout << "IMPOSSIBLE\n";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3500kb
input:
1
output:
POSSIBLE 1 1
result:
ok answer = 1
Test #2:
score: 0
Accepted
time: 1ms
memory: 3472kb
input:
2
output:
IMPOSSIBLE
result:
ok answer = 0
Test #3:
score: 0
Accepted
time: 1ms
memory: 3496kb
input:
3
output:
IMPOSSIBLE
result:
ok answer = 0
Test #4:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
4
output:
IMPOSSIBLE
result:
ok answer = 0
Test #5:
score: -100
Wrong Answer
time: 1ms
memory: 3500kb
input:
5
output:
IMPOSSIBLE
result:
wrong answer jury has the better answer: jans = 1, pans = 0 (1 is Possible)