結果
| 問題 | No.2719 Equal Inner Products in Permutation | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-02-03 01:24:30 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 886 bytes | 
| コンパイル時間 | 1,988 ms | 
| コンパイル使用メモリ | 198,008 KB | 
| 最終ジャッジ日時 | 2025-02-19 01:07:52 | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 1 | 
| other | AC * 1 WA * 29 | 
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	if (n == 1) {
		cout << -1 << endl;
		return 0;
	}
	vector<int> a2{ 1, 4 }, b2{ 3, 6 }, c2{ 5, 2 };
	vector<int> a3{ 1, 2, 9 }, b3{ 6, 8, 7 }, c3{ 3, 4, 5 };
	vector<int> a4{ 1, 2, 4, 11 }, b4{ 7, 9, 10, 12 }, c4{ 8, 5, 6, 3 };
	vector<int> a, b, c;
	if (n % 3 == 2) a = a2, b = b2, c = c2;
	else if (n % 3 == 0) a = a3, b = b3, c = c3;
	else a = a4, b = b4, c = c4;
	int len = (int)a.size();
	while (len < n) {
		for (auto x : a3) a.push_back(x + 3 * len);
		for (auto x : b3) b.push_back(x + 3 * len);
		for (auto x : c3) c.push_back(x + 3 * len);
		len += 3;
	}
	// 0-indexed で出力
	for (int i = 0; i < n; i++) cout << a[i] - 1 << " ";
	for (int i = 0; i < n; i++) cout << b[i] - 1 << " ";
	for (int i = 0; i < n; i++) cout << c[i] - 1 << " \n"[i == n - 1];
}
            
            
            
        