結果
問題 |
No.2958 Placing Many L-s
|
ユーザー |
![]() |
提出日時 | 2024-11-08 21:37:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 894 bytes |
コンパイル時間 | 2,017 ms |
コンパイル使用メモリ | 201,028 KB |
最終ジャッジ日時 | 2025-02-25 02:37:50 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 WA * 14 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ int TT; cin>>TT; set<pair<int,int>> s; s.insert({0,0}); s.insert({0,1}); s.insert({0,2}); s.insert({1,0}); while(TT--){ int N,M; cin>>N>>M; if(N%4 == 0 && M%2 == 0){ cout<<N*M/4<<endl; for(int i=0;i<N;i++){ for(int j=0;j<M;j++){ int t = (i/4)*(M/2)+j/2; int x = j%2, y = i%4; cout<<(s.count({x,y}) ? 2*t+1 : 2*t+2)<<' '; } cout<<endl; } continue; } else if(M%4 == 0 && N%2 == 0){ cout<<N*M/4<<endl; for(int i=0;i<N;i++){ for(int j=0;j<M;j++){ int t = (i/2)*(M/4)+j/4; int x = i%2, y = j%4; cout<<(s.count({x,y}) ? 2*t+1 : 2*t+2)<<' '; } cout<<endl; } continue; } else{ cout<<-1<<endl; } } }