結果

問題 No.1851 Regular Tiling
ユーザー hourenhouren
提出日時 2022-02-25 21:51:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 745 bytes
コンパイル時間 3,342 ms
コンパイル使用メモリ 163,124 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 16:41:13
合計ジャッジ時間 5,064 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 21 ms
4,376 KB
testcase_02 AC 25 ms
4,376 KB
testcase_03 AC 25 ms
4,380 KB
testcase_04 AC 23 ms
4,376 KB
testcase_05 AC 25 ms
4,376 KB
testcase_06 AC 27 ms
4,380 KB
testcase_07 AC 23 ms
4,376 KB
testcase_08 AC 23 ms
4,380 KB
testcase_09 AC 28 ms
4,380 KB
testcase_10 AC 25 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 46 ms
4,376 KB
testcase_14 AC 89 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int t;
    cin >> t;
    rep(houren,t){
        int h,w,x=2,y=2;
        cin >> h >> w;
        if(h%3==1) x=0;
        if(w%3==1) y=0;
        rep(i,h){
            rep(j,w){
                if(i%3==x && j%3==y) cout << 0 << " ";
                else if(i%3==x || j%3==y) cout << 1 << " ";
                else cout << 2 << " ";
            }
            cout << '\n';
        }
    }
    return 0;
}
0