結果
問題 | No.1831 Parasol |
ユーザー | Carpenters-Cat |
提出日時 | 2022-02-04 23:40:11 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,067 bytes |
コンパイル時間 | 838 ms |
コンパイル使用メモリ | 76,452 KB |
実行使用メモリ | 4,508 KB |
最終ジャッジ日時 | 2023-09-02 06:08:17 |
合計ジャッジ時間 | 5,597 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | RE | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | RE | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | RE | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
ソースコード
#include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> ans; for (int i = 0; i < N; i++) { ans.push_back(2 * N - 1); } int now = 0; vector<bool> did(N, false), usd(N + 1, false); did[0] = true; usd[N] = true; int cnt = 0; for (int i = 1; i < N; i++) { int fl = 1; while (fl < N && (did[(now + fl) % N] || usd[fl])) fl++; if (fl == N) { if (cnt) { return 139; } fl = 1; while (usd[fl]) { fl++; } } //cout << fl << endl; for (int j = 0; j < fl; j++) { ans.push_back(2 * fl - 1); } did[(now + fl) % N] = true; usd[fl] = true; now = (now + fl) % N; } cout << 2 * N - 1 << endl; for (int i = 0; i < 2 * N - 1; i++) { for (int j = 0; j < N; j++) { cout << ans[i + j * (2 * N - 1)] << (j < N - 1 ? " " : ""); } cout << endl; } }