QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#223796 | #7178. Bishops | Habitus | WA | 0ms | 3612kb | C++14 | 1.7kb | 2023-10-22 17:16:34 | 2023-10-22 17:16:34 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n, m;
bool zam;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n >> m;
if(n<m) {
swap(n, m);
zam=1;
}
if(m%2==1 && m<n) {
cout << m+n-1 << "\n";
for(int i=1; i<=m; i++) {
if(zam) cout << i << ' ' << 1 << "\n" << i << ' ' << n << "\n";
else cout << 1 << ' ' << i << "\n" << n << ' ' << i << "\n";
}
for(int i=m/2+2; i<=n-m/2-1; i++) {
if(zam) cout << m/2+1 << ' ' << i << "\n";
else cout << i << ' ' << m/2+1 << "\n";
}
}
else if(m==n) {
cout << m+n-2 << "\n";
for(int i=1; i<=m; i++) {
cout << 1 << ' ' << i << "\n";
}
for(int i=2; i<m; i++) {
cout << n << ' ' << i << "\n";
}
}
else if(n%2==1) {
cout << m+n-1 << "\n";
for(int i=1; i<=m; i++) {
if(zam) cout << i << ' ' << 1 << "\n" << i << ' ' << n << "\n";
else cout << 1 << ' ' << i << "\n" << n << ' ' << i << "\n";
}
for(int i=m/2+2; i<=n-m/2-1; i+=2) {
if(zam) cout << m/2+1 << ' ' << i << "\n";
else cout << i << ' ' << m/2+1 << "\n";
}
}
else {
cout << m+n-2 << "\n";
for(int i=1; i<=m; i++) {
if(zam) cout << i << ' ' << 1 << "\n" << i << ' ' << n << "\n";
else cout << 1 << ' ' << i << "\n" << n << ' ' << i << "\n";
}
for(int i=m/2+2; i<=n-m/2-1; i+=2) {
if(zam) cout << m/2+1 << ' ' << i << "\n";
else cout << i << ' ' << m/2+1 << "\n";
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3612kb
input:
2 5
output:
6 1 1 1 5 2 1 2 5 2 3
result:
wrong output format Unexpected end of file - int32 expected