結果

問題 No.1061 素敵な数列
ユーザー zelnyokzelnyok
提出日時 2020-05-22 22:56:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,311 bytes
コンパイル時間 1,373 ms
コンパイル使用メモリ 121,196 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-15 18:13:08
合計ジャッジ時間 5,551 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 WA -
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 WA -
testcase_07 AC 2 ms
6,940 KB
testcase_08 WA -
testcase_09 AC 2 ms
6,944 KB
testcase_10 WA -
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 WA -
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 WA -
testcase_20 AC 6 ms
6,940 KB
testcase_21 AC 13 ms
6,944 KB
testcase_22 AC 24 ms
6,944 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 19 ms
6,944 KB
testcase_26 AC 5 ms
6,944 KB
testcase_27 WA -
testcase_28 AC 13 ms
6,940 KB
testcase_29 AC 17 ms
6,944 KB
testcase_30 WA -
testcase_31 AC 12 ms
6,944 KB
testcase_32 AC 26 ms
6,940 KB
testcase_33 WA -
testcase_34 AC 7 ms
6,944 KB
testcase_35 AC 6 ms
6,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
constexpr lnt INF = 2e18;
/*-*/

int main() {
	int n;
	std::cin >> n;
	if(n%3==2) {
		print(-1);
		return 0;
	}
	int k=n/3;
	std::vector<int> ans;
	for(int i=k*3-1;i>=0;i-=3) {
		ans.emplace_back(i);
		ans.emplace_back(i);
	}
	if(k*3-2>=0) ans.emplace_back(k*3-2);
	if(k*3-2>=0) ans.emplace_back(k*3-2);
	for(int i=2;i<=k*3-1;i+=3) {
		ans.emplace_back(i);
	}
	for(int i=k*3-5;i>=0;i-=3) {
		ans.emplace_back(i);
		ans.emplace_back(i);
	}
	if(k*3-2>=0) ans.emplace_back(k*3-2);
	for(int i=1;i<=k*3-5;i+=3) {
		ans.emplace_back(i);
	}
	debug(ans);
	for(int i=((n%3)?3*k:n-3);i>=0;i-=3) {
		ans.emplace_back(i);
		ans.emplace_back(i);
	}
	debug(ans);
	for(int i=0;i<n;i+=3) {
		ans.emplace_back(i);
	}
	for(auto x:ans) std::cout << x << ' ';
	std::cout << EL;
}
0