結果

問題 No.3287 Golden Ring
ユーザー snrnsidy
提出日時 2025-10-03 21:24:54
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 620 bytes
コンパイル時間 727 ms
コンパイル使用メモリ 97,480 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-10-03 21:24:56
合計ジャッジ時間 1,655 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <unordered_set>
#include <cstring>
#include <queue>
#include <bitset>
#include <map>
#include <stack>

using namespace std;

int main() 
{
	cin.tie(0);
    ios::sync_with_stdio(false);

	int n,t;
	vector <int> v;

	cin >> n;
	
	if(n==2)
	{
		cout << "No" << '\n';
		return 0;
	}
	
	int a = 1;	
	int b = n;
	if(b%2==1) b-=1;
	cout << "Yes" << '\n';
	while(b > 0)
	{
		v.push_back(b);
		b-=2;
	}
	while(a <= n)
	{
		v.push_back(a);
		a += 2;
	}

	for(auto it : v)
	{
		cout << it << ' ';
	}
	cout << '\n';
    return 0;
}
0