提出 #74712596
ソースコード 拡げる
#pragma GCC optimize("O3")
#include <iostream>
#include <cmath>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <cstdint>
#include <iomanip>
using namespace std;
using ll = int64_t;
void bruteforce()
{
int n;
cin >> n;
vector<int> p(n);
int best = 1e9;
vector<int> resA{};
iota(p.begin(), p.end(), 1);
do
{
int res = 0;
int curr = 0;
for (int j = 0; j < n; ++j)
{
curr ^= p[j];
res += curr;
}
if (res < best)
{
best = res;
resA = p;
}
} while (next_permutation(p.begin(), p.end()));
for (int num : resA)
{
cout << num << ' ';
}
cout << '\n';
}
void solve()
{
int n;
cin >> n;
vector<int> p(n);
iota(p.begin(), p.end(), 1);
for (int i = 1; i + 1 < n; i += 4)
{
swap(p[i], p[i + 1]);
}
for(int num : p)
{
cout << num << ' ';
}
cout << '\n';
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--)
{
solve();
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | A - Min of Sum of XOR |
| ユーザ | RomanLeshchuk |
| 言語 | C++23 (GCC 15.2.0) |
| 得点 | 500 |
| コード長 | 1418 Byte |
| 結果 | AC |
| 実行時間 | 9 ms |
| メモリ | 4220 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 500 / 500 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00_sample_00.txt |
| All | 00_sample_00.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00_sample_00.txt | AC | 3 ms | 3540 KiB |
| 01_random_00.txt | AC | 8 ms | 4136 KiB |
| 01_random_01.txt | AC | 8 ms | 4164 KiB |
| 01_random_02.txt | AC | 9 ms | 4200 KiB |
| 01_random_03.txt | AC | 8 ms | 4156 KiB |
| 01_random_04.txt | AC | 8 ms | 4168 KiB |
| 01_random_05.txt | AC | 8 ms | 4164 KiB |
| 01_random_06.txt | AC | 8 ms | 4220 KiB |
| 01_random_07.txt | AC | 8 ms | 4168 KiB |
| 01_random_08.txt | AC | 8 ms | 4164 KiB |
| 01_random_09.txt | AC | 9 ms | 4208 KiB |
| 01_random_10.txt | AC | 7 ms | 3656 KiB |
| 01_random_11.txt | AC | 7 ms | 3544 KiB |
| 01_random_12.txt | AC | 7 ms | 3408 KiB |