結果
| 問題 |
No.1831 Parasol
|
| コンテスト | |
| ユーザー |
SSRS
|
| 提出日時 | 2022-02-04 22:08:47 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 895 bytes |
| コンパイル時間 | 2,217 ms |
| コンパイル使用メモリ | 201,100 KB |
| 最終ジャッジ日時 | 2025-01-27 19:10:54 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 WA * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<vector<int>> ans(N * 2 - 1);
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
for (int i = 1; i <= N * 2 - 1; i++){
int R = i;
if (i % 2 == 1){
ans[N * 2 - 2].push_back(i);
R--;
}
if (i >= 2 && i <= N){
ans[i * 2 - 4].push_back(i);
ans[i * 2 - 3].push_back(i);
R -= 2;
pq.push(make_pair(1, i * 2 - 4));
pq.push(make_pair(1, i * 2 - 3));
}
for (int j = 0; j < R; j++){
int p = pq.top().second;
pq.pop();
ans[p].push_back(i);
pq.push(make_pair(ans[p].size(), p));
}
}
cout << N * 2 - 1 << endl;
for (int i = 0; i < N * 2 - 1; i++){
for (int j = 0; j < N; j++){
cout << ans[i][j];
if (j < N - 1){
cout << ' ';
}
}
cout << endl;
}
}
SSRS