結果
問題 | No.1831 Parasol |
ユーザー | startcpp |
提出日時 | 2022-02-04 23:32:31 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 792 bytes |
コンパイル時間 | 585 ms |
コンパイル使用メモリ | 71,560 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-09-02 06:03:56 |
合計ジャッジ時間 | 2,143 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 19 ms
4,380 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 19 ms
4,380 KB |
testcase_05 | AC | 1 ms
4,376 KB |
testcase_06 | AC | 1 ms
4,380 KB |
testcase_07 | AC | 18 ms
4,380 KB |
testcase_08 | AC | 1 ms
4,380 KB |
testcase_09 | AC | 1 ms
4,376 KB |
testcase_10 | AC | 13 ms
4,384 KB |
testcase_11 | AC | 18 ms
4,376 KB |
testcase_12 | AC | 9 ms
4,380 KB |
testcase_13 | AC | 17 ms
4,380 KB |
testcase_14 | AC | 3 ms
4,376 KB |
testcase_15 | AC | 5 ms
4,376 KB |
testcase_16 | AC | 2 ms
4,380 KB |
testcase_17 | AC | 1 ms
4,376 KB |
testcase_18 | AC | 4 ms
4,376 KB |
testcase_19 | AC | 1 ms
4,380 KB |
ソースコード
//N <= 5で実験したら対角に並んでいる地形が出てきたので、それっぽい構築に直してみた。 #include <iostream> #include <vector> using namespace std; int n; bool used[599][600]; int main() { int y, x; cin >> n; int a = 0, b = 0; for (x = 2 * n - 1; x >= n; x--) { for (y = 0; y < a; y++) used[y][x] = true; a += 1; for (y = b; y < 2 * n - 1; y++) used[y][x] = true; b += 2; } for (x = 1; x < n; x++) { for (y = x; y < 2 * x; y++) used[y][x] = true; } cout << 2 * n - 1 << endl; for (y = 0; y < 2 * n - 1; y++) { vector<int> ans; for (x = 1; x <= 2 * n - 1; x++) if (used[y][x]) ans.push_back(x); for (x = 0; x < ans.size(); x++) { cout << ans[x]; if (x + 1 < ans.size()) cout << " "; } cout << endl; } return 0; }