Submission #74715464
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
//#define int long long
//#define float long double
using uint = unsigned;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pff = pair<float,float>;
using pdd = pair<ld,ld>;
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
const ld PI = 3.14159265358979323846;
const ld E = 2.71828182845904523536;
const int MOD = 998244353;
int bin_pow(int a,int b)
{
int ans = 1;
while(b != 0)
{
if(b & 1)
ans = ans * a;
a = a * a;
b >>= 1;
}
return ans;
}
void solve()
{
int n;
cin >> n;
int cnt = 0;
for(int i = 1;i <= bin_pow(2,log2(n+1))-1;i++)
{
cout << (i ^ (i >> 1)) << ' ',cnt++;
}
vector<int> rem;
for(int i = bin_pow(2,log2(n+1));i <= 16*n;i++)
{
if(cnt >= n)
break;
if((i ^ (i >> 1)) <= n)
rem.pb((i ^ (i >> 1))),cnt++;
}
if(!rem.empty() && rem[0] > rem.back())
reverse(all(rem));
for(auto i : rem)
cout << i << ' ';
cout << endl;
}
signed main()
{
std::cin.tie(nullptr);std::ios::sync_with_stdio(false);
int tt = 1;
cin >> tt;
while(tt--)
{
solve();
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - Min of Sum of XOR |
| User | Cd5 |
| Language | C++23 (GCC 15.2.0) |
| Score | 0 |
| Code Size | 1475 Byte |
| Status | WA |
| Exec Time | 8 ms |
| Memory | 4296 KiB |
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 500 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| 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 |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 3876 KiB |
| 01_random_00.txt | WA | 8 ms | 4296 KiB |
| 01_random_01.txt | AC | 8 ms | 4048 KiB |
| 01_random_02.txt | WA | 8 ms | 4120 KiB |
| 01_random_03.txt | WA | 8 ms | 4176 KiB |
| 01_random_04.txt | WA | 8 ms | 4072 KiB |
| 01_random_05.txt | AC | 8 ms | 4176 KiB |
| 01_random_06.txt | WA | 8 ms | 4176 KiB |
| 01_random_07.txt | WA | 8 ms | 4296 KiB |
| 01_random_08.txt | WA | 8 ms | 4172 KiB |
| 01_random_09.txt | AC | 8 ms | 4012 KiB |
| 01_random_10.txt | WA | 7 ms | 3832 KiB |
| 01_random_11.txt | WA | 7 ms | 3624 KiB |
| 01_random_12.txt | WA | 6 ms | 3728 KiB |