結果

問題 No.1851 Regular Tiling
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-05-21 22:16:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 1,038 bytes
コンパイル時間 889 ms
コンパイル使用メモリ 105,736 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-23 15:15:26
合計ジャッジ時間 3,760 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

int G[102][102];

void solve(){
    int H, W;
    cin >> H >> W;
    int a=0, b=H/3*3, c=0, d=W/3*3;

    if (H % 3 == 1) b++;
    if (H % 3 == 2){
        a+=1;
        b+=3;
    }
    if (W % 3 == 1) d++;
    if (W % 3 == 2){
        c+=1;
        d+=3;
    }
    for (int i=a; i<b; i++){
        for (int j=c; j<d; j++) cout << G[i][j] << " ";
        cout << endl;
    }
}

int main(){

    for (int i=0; i<34; i++){
        for (int j=0; j<34; j++){
            G[i*3][j*3] = 0; G[i*3][j*3+1] = 1; G[i*3][j*3+2] = 1;
            G[i*3+1][j*3] = 1; G[i*3+1][j*3+1] = 2; G[i*3+1][j*3+2] = 2;
            G[i*3+2][j*3] = 1; G[i*3+2][j*3+1] = 2; G[i*3+2][j*3+2] = 2;
        }
    }

    int T;
    cin >> T;
    while(T){
        T--;
        solve();
    }

    return 0;
}
0