結果
問題 | No.630 門松グラフ |
ユーザー |
|
提出日時 | 2018-01-05 22:19:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,502 bytes |
コンパイル時間 | 874 ms |
コンパイル使用メモリ | 68,044 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 06:45:15 |
合計ジャッジ時間 | 5,240 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 WA * 11 |
ソースコード
#include <iostream> using namespace std; #define not_spindle_points 2 * (N - 2) - M int main(){ int N, M; cin >> N >> M; if(M < N - 1 || M > 2 * (N - 2)){ cout << "NO" << endl; return 0; } cout << "YES" << endl; if(M == N - 1){ string a_array_string = ""; for(int i = 0; i < N; i++){ if(i % 2){ a_array_string += to_string(N - i / 2) + " "; }else{ a_array_string += to_string(i / 2 + 1) + " "; } } a_array_string.pop_back(); cout << a_array_string << endl; for(int i = 0; i < M; i++){ cout << i + 1 << " " << i + 2 << endl; } }else{ string a_array_string = ""; for(int i = 0; i < not_spindle_points + 3; i++){ if(i % 2){ a_array_string += to_string(not_spindle_points + 3 - i / 2) + " "; }else{ a_array_string += to_string(i / 2 + 1) + " "; } } for(int i = not_spindle_points + 3; i < N; i++){ a_array_string += to_string(i + 1) + " "; } a_array_string.pop_back(); cout << a_array_string << endl; for(int i = 0; i < not_spindle_points + 2; i++){ cout << i + 1 << " " << i + 2 << endl; } for(int i = not_spindle_points + 3; i < N; i++){ cout << 1 << " " << i + 1 << endl; cout << i + 1 << " " << 3 << endl; } } }