結果
| 問題 |
No.2719 Equal Inner Products in Permutation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-05 23:29:17 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,782 bytes |
| コンパイル時間 | 11,681 ms |
| コンパイル使用メモリ | 279,884 KB |
| 最終ジャッジ日時 | 2025-02-20 22:05:29 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 28 |
ソースコード
#ifdef LOCAL
#include <local.hpp>
#else
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2")
#include <bits/stdc++.h>
#define debug(...) ((void)0)
#define postprocess(...) ((void)0)
#endif
using namespace std;
using ll = long long;
using ld = long double;
vector<int> p6 = {1, 4, 3, 6, 5, 2};
vector<int> p9 = {1, 2, 8, 3, 6, 9, 7, 5, 4};
void solve([[maybe_unused]] int test) {
int N;
cin >> N;
if (N == 1) {
cout << -1 << endl;
return;
}
vector<int> ans1, ans2, ans3;
int next = 0;
if (N % 2 == 0) {
ans1.push_back(p6[0]);
ans1.push_back(p6[1]);
ans2.push_back(p6[2]);
ans2.push_back(p6[3]);
ans3.push_back(p6[4]);
ans3.push_back(p6[5]);
next = 7;
} else {
ans1.push_back(p9[0]);
ans1.push_back(p9[1]);
ans1.push_back(p9[2]);
ans2.push_back(p9[3]);
ans2.push_back(p9[4]);
ans2.push_back(p9[5]);
ans3.push_back(p9[6]);
ans3.push_back(p9[7]);
ans3.push_back(p9[8]);
next = 10;
}
// {0, 3, 2, 5, 4, 1};
while (next < 3 * N) {
ans1.push_back(next + 0);
ans1.push_back(next + 5);
ans2.push_back(next + 4);
ans2.push_back(next + 1);
ans3.push_back(next + 2);
ans3.push_back(next + 3);
next += 6;
}
for (auto&& x : ans1) {
cout << x << " ";
}
for (auto&& x : ans2) {
cout << x << " ";
}
for (auto&& x : ans3) {
cout << x << " ";
}
cout << endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t;
for (int i = 1; i <= t; i++) {
solve(i);
}
postprocess();
}