結果
| 問題 |
No.3012 岩井星人グラフ
|
| コンテスト | |
| ユーザー |
のらら
|
| 提出日時 | 2025-06-22 23:33:21 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,423 bytes |
| コンパイル時間 | 3,731 ms |
| コンパイル使用メモリ | 183,504 KB |
| 実行使用メモリ | 42,124 KB |
| 最終ジャッジ日時 | 2025-06-22 23:33:32 |
| 合計ジャッジ時間 | 10,821 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 4 WA * 18 RE * 1 |
ソースコード
#include <iostream>
#include <algorithm>
#include <atcoder/all>
#include <set>
using namespace std;
using namespace atcoder;
using ll = long long;
//#define endl "\n";
int randInt(int L, int R){
return rand() % (R - L + 1) + L;
}
set<ll> st[250009];
int main(){
ll X, Y;
cin >> X >> Y;
//次数が3の頂点間でX本辺を張る
for(int i = 0; i < X; i++){
ll p1, p2;
while(1){
p1 = randInt(1, X);
p2 = randInt(1, X);
if(p1 == p2) continue;
if(p1 > p2) swap(p1, p2);
if(st[p1].find(p2) == st[p1].end()) break;
}
st[p1].insert(p2);
st[p2].insert(p1);
}
//頂点1~Xから3-次数本、長さY-1の腕を生やす
int idx = X;
for(int i = 1; i <= X; i++){
for(int j = (int)st[i].size() + 1; j <= 3; j++){
int pre = i;
for(int k = 1; k <= Y - 1; k++){
idx++;
st[pre].insert(idx);
st[idx].insert(pre);
pre = idx;
}
}
}
vector<pair<ll,ll>> ret;
for(int i = 1; i <= X * Y; i++){
for(auto itr = st[i].begin(); itr != st[i].end(); ++itr){
if(i < *itr){
ret.push_back({i, *itr});
}
}
}
cout << X * Y << " " << ret.size() << endl;
for(auto[a, b]: ret) cout << a << " " << b << endl;
return 0;
}
のらら