QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#218317 | #7178. Bishops | acagubica | WA | 0ms | 3624kb | C++14 | 1.1kb | 2023-10-17 23:51:36 | 2023-10-17 23:51:36 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n,m;
bool swaped=false;
vector<int>solx,soly;
void solveforodd(){
if(m>=n+1){
for(int i=1; i<=n; i++){
solx.push_back(i);
soly.push_back(1);
solx.push_back(i);
soly.push_back(m);
}
for(int j=n/2+2; j<=m-n/2-1; j++){
solx.push_back(n/2+1);
soly.push_back(j);
}
return;
}
if(m==1){
solx.push_back(1);
soly.push_back(1);
return;
}
for(int i=1; i<=n; i++){
solx.push_back(i);
soly.push_back(1);
}
for(int i=2; i<=n-1; i++){
solx.push_back(i);
soly.push_back(m);
}
return;
}
int main(){
cin>>n>>m;
if(n>m){
swap(n,m);
swaped=true;
}
if(n%2==1)solveforodd();
cout<<solx.size()<<"\n";
if(swaped)swap(solx,soly);
for(int i=0; i<solx.size(); i++)cout<<soly[i]<<" "<<solx[i]<<"\n";
/*
bool mat[105][105];
for(int i=0; i<solx.size(); i++)mat[soly[i]][solx[i]]=true;
*/
/*
if(swaped)swap(n,m);
for(int i=1; i<=m; i++){
for(int j=1; j<=n; j++)
cout<<mat[i][j]<<" ";
cout<<endl;
}
*/
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3624kb
input:
2 5
output:
0
result:
wrong answer Participant's answer is not optimal (0 < 6)