結果
| 問題 | No.3585 Make Ends Meet (Easy) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-10 21:36:01 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,360 bytes |
| 記録 | |
| コンパイル時間 | 1,115 ms |
| コンパイル使用メモリ | 214,476 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-10 21:36:05 |
| 合計ジャッジ時間 | 3,541 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 42 WA * 6 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
auto no = [&]() -> void {cout << "No\n"; exit(0);};
int N,M,K; cin >> N >> M >> K;
int edge = N*(N-1)/2;
if(K == 1){
if(M == edge) no();
cout << "Yes\n";
for(int i=0; i<N; i++) for(int k=i+1; k<N; k++){
if(i == 0 && k == N-1) continue;
if(M == 0) continue;
M--;
cout << i+1 << " " << k+1 << "\n";
}
}
else if(K == 2){
if(M >= edge-1 || M == 0) no();
cout << "Yes\n";
cout << "1 " << N << "\n",M--;
for(int i=0; i<N; i++) for(int k=i+1; k<N; k++){
if(i == 0 && k == N-1) continue;
if(i == 0 && k == 1) continue;
if(i == 1 && k == N-1) continue;
cout << i+1 << " " << k+1 << "\n";
}
}
else{
vector<pair<int,int>> del;
for(int i=0; i<K-1; i++) for(int k=i+2; k<N; k++) del.push_back({i,k});
if(M < del.size()) no();
for(int i=K-1; i<N; i++) for(int k=i+1; k<N; k++){
if(i == K-1 && k == N-1) continue;
if(del.size() < M) del.push_back({i,k});
}
if(del.size() != M) no();
cout << "Yes\n";
for(auto [u,v] : del) cout << u+1 << " " << v+1 << "\n";
}
}