結果
| 問題 |
No.630 門松グラフ
|
| コンテスト | |
| ユーザー |
Kutimoti_T
|
| 提出日時 | 2018-01-05 23:12:31 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,394 bytes |
| コンパイル時間 | 592 ms |
| コンパイル使用メモリ | 70,504 KB |
| 実行使用メモリ | 271,172 KB |
| 最終ジャッジ日時 | 2024-12-23 07:16:26 |
| 合計ジャッジ時間 | 26,108 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 MLE * 2 |
| other | AC * 10 WA * 9 TLE * 7 MLE * 6 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <sstream>
using namespace std;
#define FOR(i, s, e) for (int i = (s); i <= (e); i++)
int N;
int M;
int a[100001];
int MAX = 100000;
int MIN = 1;
stringstream result;
int main()
{
cin >> N >> M;
if (N - 1 > M)
{
cout << "NO" << endl;
return 0;
}
for (int i = 1; i <= N; i++)
{
if (i % 2 == 1)
{
a[i] = MAX;
MAX--;
}
else
{
a[i] = MIN;
MIN++;
}
if (i <= N - 1)
{
result << i << " " << i + 1 << endl;
M--;
}
}
if (M == 0)
{
cout << "YES" << endl;
FOR(i, 1, N)
cout << a[i] << " ";
cout << endl;
cout << result.str();
return 0;
}
for (int i = 1; i <= N; i++)
{
for (int j = i + 3; j <= N; j += 2)
{
result << i << " " << j << endl;
if (M == 0)
{
cout << "YES" << endl;
M--;
FOR(i, 1, N)
cout << a[i] << " ";
cout << endl;
cout << result.str();
return 0;
}
}
}
cout << "NO" << endl;
return 0;
}
Kutimoti_T