結果
| 問題 |
No.1519 Diversity
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2021-05-28 21:20:08 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 827 bytes |
| コンパイル時間 | 6,835 ms |
| コンパイル使用メモリ | 253,556 KB |
| 最終ジャッジ日時 | 2025-01-21 19:37:41 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 15 |
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001
int main(){
int N;
cin>>N;
priority_queue<pair<int,int>> Q;
Q.emplace(1,0);
Q.emplace(1,1);
vector<int> a(1,0),b(1,1);
vector<int> d(N,0);
d[0] = 1;
d[1] = 1;
for(int i=2;i<N;i++){
vector<int> inds;
while(true){
pair<int,int> p = Q.top();
Q.pop();
if(Q.size()==0 || d[i]+1>Q.top().first+1){
Q.push(p);
break;
}
inds.push_back(p.second);
d[i]++;
}
rep(j,inds.size()){
a.push_back(i);
b.push_back(inds[j]);
d[inds[j]]++;
Q.emplace(d[inds[j]],inds[j]);
}
Q.emplace(d[i],i);
}
rep(i,a.size()){
printf("%d %d\n",a[i]+1,b[i]+1);
}
return 0;
}
沙耶花