結果
問題 | No.1831 Parasol |
ユーザー |
![]() |
提出日時 | 2022-02-04 23:50:16 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 949 bytes |
コンパイル時間 | 2,768 ms |
コンパイル使用メモリ | 211,152 KB |
最終ジャッジ日時 | 2025-01-27 20:10:55 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 19 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include<bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin>>n; priority_queue<pair<int,int>> que; for(int i=1;i<2*n;i++) que.push({i,i}); vector<vector<int>> A; vector<int> B; map<int,int> m; vector<pair<int,int>> T; while(1){ if(que.empty()) break; auto t=que.top(); que.pop(); if(m[t.second]>=2) T.push_back(t); else{ B.push_back(t.second); t.first--; m[t.second]++; if(t.first>0) que.push(t); if(B.size()==n){ A.push_back(B); B.clear(); m.clear(); for(auto s:T) que.push(s); T.clear(); } } } int a=A.size(); cout<<a<<endl; rep(i,a){ rep(j,n){ if(j) cout<<" "; cout<<A[i][j]; } cout<<endl; } return 0; }