結果
問題 | No.1398 調和の魔法陣 (構築) |
ユーザー | chocorusk |
提出日時 | 2021-02-19 22:18:42 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 22 ms / 3,153 ms |
コード長 | 1,327 bytes |
コンパイル時間 | 1,140 ms |
コンパイル使用メモリ | 127,844 KB |
実行使用メモリ | 4,956 KB |
最終ジャッジ日時 | 2023-10-15 02:30:49 |
合計ジャッジ時間 | 25,386 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,348 KB |
testcase_01 | AC | 2 ms
4,352 KB |
testcase_02 | AC | 1 ms
4,348 KB |
testcase_03 | AC | 2 ms
4,348 KB |
testcase_04 | AC | 1 ms
4,348 KB |
testcase_05 | AC | 2 ms
4,348 KB |
testcase_06 | AC | 21 ms
4,812 KB |
testcase_07 | AC | 3 ms
4,732 KB |
testcase_08 | AC | 22 ms
4,752 KB |
testcase_09 | AC | 22 ms
4,820 KB |
testcase_10 | AC | 3 ms
4,744 KB |
testcase_11 | AC | 22 ms
4,712 KB |
testcase_12 | AC | 3 ms
4,716 KB |
testcase_13 | AC | 22 ms
4,772 KB |
testcase_14 | AC | 22 ms
4,728 KB |
testcase_15 | AC | 3 ms
4,948 KB |
testcase_16 | AC | 22 ms
4,808 KB |
testcase_17 | AC | 22 ms
4,812 KB |
testcase_18 | AC | 22 ms
4,712 KB |
testcase_19 | AC | 22 ms
4,808 KB |
testcase_20 | AC | 3 ms
4,844 KB |
testcase_21 | AC | 22 ms
4,768 KB |
testcase_22 | AC | 22 ms
4,956 KB |
testcase_23 | AC | 2 ms
4,756 KB |
testcase_24 | AC | 22 ms
4,732 KB |
testcase_25 | AC | 3 ms
4,732 KB |
testcase_26 | AC | 22 ms
4,732 KB |
testcase_27 | AC | 22 ms
4,728 KB |
testcase_28 | AC | 2 ms
4,732 KB |
testcase_29 | AC | 22 ms
4,792 KB |
testcase_30 | AC | 3 ms
4,792 KB |
ソースコード
#include <cstdio> #include <cstring> #include <iostream> #include <string> #include <cmath> #include <bitset> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <algorithm> #include <complex> #include <unordered_map> #include <unordered_set> #include <random> #include <cassert> #include <fstream> #include <utility> #include <functional> #include <time.h> #include <stack> #include <array> #include <list> #define popcount __builtin_popcount using namespace std; typedef long long ll; typedef pair<int, int> P; int m[606][606]; int main() { int w, h, x; cin>>w>>h>>x; for(int i=0; i<h; i++){ for(int j=0; j<w; j++) m[i][j]=-1; } for(int i=2; i<h; i+=3) for(int j=0; j<w; j++) m[i][j]=0; for(int i=0; i<h; i++) for(int j=2; j<w; j+=3) m[i][j]=0; for(int i=h-3; i>=0; i-=3) for(int j=0; j<w; j++) m[i][j]=0; for(int i=0; i<h; i++) for(int j=w-3; j>=0; j-=3) m[i][j]=0; for(int i=0; i<3; i++){ for(int j=0; j<3; j++){ if(m[i][j]==-1){ m[i][j]=min(9, x); x-=m[i][j]; } } } if(x){ cout<<-1<<endl; return 0; } for(int i=0; i<h; i++){ for(int j=0; j<w; j++){ cout<<m[i%3][j%3]; } cout<<endl; } return 0; }