結果
| 問題 |
No.1384 Bishop and Rook
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-07 22:18:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 812 bytes |
| コンパイル時間 | 575 ms |
| コンパイル使用メモリ | 67,204 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-04 16:05:09 |
| 合計ジャッジ時間 | 25,225 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 55 |
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
4 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
int T,N,M;
main()
{
cin>>T;
for(;T--;)
{
cin>>N>>M;
if(N%2!=0||M%2!=0)
{
cout<<-1<<endl;
continue;
}
cout<<N*M-1<<endl;
for(int j=1;j<M;j+=2)
{
if(j/2%2==0)
{
for(int i=1;i+2<N;i+=2)
{
cout<<i<<" "<<j<<endl;
cout<<i+1<<" "<<j+1<<endl;
cout<<i<<" "<<j+1<<endl;
cout<<i+1<<" "<<j<<endl;
}
cout<<N-1<<" "<<j<<endl;
cout<<N<<" "<<j+1<<endl;
cout<<N<<" "<<j<<endl;
cout<<N-1<<" "<<j+1<<endl;
}
else
{
cout<<N-1<<" "<<j<<endl;
cout<<N<<" "<<j+1<<endl;
cout<<N<<" "<<j<<endl;
cout<<N-1<<" "<<j+1<<endl;
for(int i=N-3;i>0;i-=2)
{
cout<<i+1<<" "<<j+1<<endl;
cout<<i<<" "<<j<<endl;
cout<<i+1<<" "<<j<<endl;
cout<<i<<" "<<j+1<<endl;
}
}
}
}
}