QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#369376 | #4325. Kraljice | nvujica | 0 | 1ms | 3672kb | C++14 | 1.9kb | 2024-03-28 05:13:10 | 2024-03-28 05:13:11 |
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 % 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: 1ms
memory: 3672kb
input:
1
output:
1 1 1
result:
ok 1 queen(s)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
2
output:
1 2 2
result:
ok 1 queen(s)
Test #3:
score: 0
Accepted
time: 1ms
memory: 3576kb
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: -6
Wrong Answer
time: 1ms
memory: 3612kb
input:
4
output:
13 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
result:
wrong answer you placed 13 queen(s) but expected 14 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%