結果
問題 |
No.1831 Parasol
|
ユーザー |
|
提出日時 | 2022-02-05 03:07:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 657 bytes |
コンパイル時間 | 2,091 ms |
コンパイル使用メモリ | 195,736 KB |
最終ジャッジ日時 | 2025-01-27 20:20:47 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main () { int N; cin >> N; int M = N * 2 - 1; cout << M << endl; vector<int> ans; for (int i = M; i >= N; i --) { int a = i; if ((M - i) % 2) { a = M - i; } for (int j = 0; j < a; j ++) { ans.push_back(a); } if (a < M) { for (int j = 0; j < M - a; j ++) { ans.push_back(M - a); } } } for (int i = 0; i < M; i ++) { for (int j = 0; j < N; j ++) { cout << ans[i + j * M] << (j < N - 1 ? " " : ""); } cout << endl; } }