QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#369381 | #4325. Kraljice | nvujica | 0 | 0ms | 3672kb | C++14 | 2.2kb | 2024-03-28 05:30:10 | 2024-03-28 05:30:10 |
answer
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;
const int maxn = 1e5 + 10;
void nep(int n){
if(n == 1){
cout << "1 1\n";
return;
}
nep(n - 2);
for(int i = 0; i < (n - 3) / 2; i += 2){
cout << n << ' ' << i + 1 << "\n";
cout << n - 1 << ' ' << i + 1 << "\n";
cout << i + 1 << ' ' << n - 1 << "\n";
cout << i + 1 << ' ' << n << "\n";
cout << n - 1 << ' ' << i + 2 << "\n";
cout << n << ' ' << i + 2 << "\n";
cout << i + 2 << ' ' << n << "\n";
cout << i + 2 << ' ' << n - 1 << "\n";
}
cout << n << ' ' << n - 1 << "\n";
cout << n << ' ' << n - 2 << "\n";
cout << n - 2 << ' ' << n << "\n";
cout << n - 1 << ' ' << n << "\n";
cout << n - 2 << ' ' << n - 1 << "\n";
cout << n - 1 << ' ' << n - 1 << "\n";
cout << n - 1 << ' ' << n - 2 << "\n";
cout << n << ' ' << n << "\n";
}
void par(int n){
if(n == 2){
cout << "2 2\n";
return;
}
par(n - 2);
cout << n << ' ' << n - 1 << "\n";
cout << n - 1 << ' ' << n - 1 << "\n";
cout << n - 1 << ' ' << n << "\n";
cout << n << ' ' << n << "\n";
for(int i = 0; i < n - 3; i++){
cout << n << ' ' << i + 1 << "\n";
cout << n - 1 << ' ' << i + 1 << "\n";
cout << i + 1 << ' ' << n - 1 << "\n";
cout << i + 1 << ' ' << n << "\n";
}
if(n == 4){
cout << n << ' ' << n - 2 << "\n";
cout << n - 1 << ' ' << n - 2 << "\n";
cout << n - 2 << ' ' << n - 1 << "\n";
cout << n - 2 << ' ' << n << "\n";
}
else {
cout << n - 1 << ' ' << n - 2 << "\n";
cout << n << ' ' << n - 2 << "\n";
cout << n - 2 << ' ' << n << "\n";
cout << n - 2 << ' ' << n - 1 << "\n";
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
if(n == 4){
cout << "14\n";
cout << "3 3\n";
cout << "1 2\n";
cout << "1 3\n";
cout << "3 1\n";
cout << "2 1\n";
cout << "3 2\n";
cout << "2 2\n";
cout << "2 3\n";
cout << "4 1\n";
cout << "4 2\n";
cout << "2 4\n";
cout << "1 4\n";
cout << "4 4\n";
cout << "4 3\n";
return 0;
}
if(n % 2 == 1){
cout << n * n << "\n";
nep(n);
}
else {
cout << n * n - 3 << "\n";
par(n);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 6
Accepted
time: 0ms
memory: 3612kb
input:
1
output:
1 1 1
result:
ok 1 queen(s)
Test #2:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
2
output:
1 2 2
result:
ok 1 queen(s)
Test #3:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
3
output:
9 1 1 3 2 3 1 1 3 2 3 1 2 2 2 2 1 3 3
result:
ok 9 queen(s)
Test #4:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
4
output:
14 3 3 1 2 1 3 3 1 2 1 3 2 2 2 2 3 4 1 4 2 2 4 1 4 4 4 4 3
result:
ok 14 queen(s)
Test #5:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
5
output:
25 1 1 3 2 3 1 1 3 2 3 1 2 2 2 2 1 3 3 5 1 4 1 1 4 1 5 4 2 5 2 2 5 2 4 5 4 5 3 3 5 4 5 3 4 4 4 4 3 5 5
result:
ok 25 queen(s)
Test #6:
score: -6
Wrong Answer
time: 0ms
memory: 3672kb
input:
6
output:
33 2 2 4 3 3 3 3 4 4 4 4 1 3 1 1 3 1 4 4 2 3 2 2 3 2 4 6 5 5 5 5 6 6 6 6 1 5 1 1 5 1 6 6 2 5 2 2 5 2 6 6 3 5 3 3 5 3 6 5 4 6 4 4 6 4 5
result:
wrong answer you placed 33 queen(s) but expected 34 queen(s)
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%