結果
問題 | No.1831 Parasol |
ユーザー |
|
提出日時 | 2022-02-04 23:35:25 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 877 bytes |
コンパイル時間 | 2,037 ms |
コンパイル使用メモリ | 197,328 KB |
最終ジャッジ日時 | 2025-01-27 20:03:47 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 1 |
other | WA * 3 RE * 16 |
ソースコード
#include <bits/stdc++.h> 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, false); did[0] = true; usd[2 * N - 1] = true; for (int i = 1; i < N; i ++) { int fl = 1; while (fl < N && (did[(now + fl) % N] || usd[fl])) fl ++; if (fl == N) { return 139; } 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; } }