Submission #74715400
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ll T,N,x;
cin >> T;
for(ll i = 0;i < T;i++){
cin >> N;
if(N == 1){
cout << 1 << endl;
continue;
}
if(N == 2){
cout << 1 << " " << 2 << endl;
continue;
}
if(N == 3){
cout << 1 << " " << 3 << " " << 2 << endl;
continue;
}
vector<ll> ans = {0,1,3,2};
N-=3;
while(N != 0){
if(ans.size() <= N){
x = ans.size();
N-=x;
for(ll j = 0;j < x;j++){
ans.push_back(ans[j] + x);
}
}
else{
x = ans.size();
for(ll j = 0;j < N;j++){
ans.push_back(ans[j] + x);
}
if(ans.size() % 4 == 3){
ans[ans.size() - 1]--;
}
N = 0;
}
}
for(ll i = 1;i < ans.size();i++){
cout << ans[i] << " ";
}
cout << endl;
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - Min of Sum of XOR |
| User | MI6174 |
| Language | C++23 (GCC 15.2.0) |
| Score | 500 |
| Code Size | 949 Byte |
| Status | AC |
| Exec Time | 10 ms |
| Memory | 5604 KiB |
Compile Error
./Main.cpp: In function 'int main()':
./Main.cpp:25:21: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
25 | if(ans.size() <= N){
| ~~~~~~~~~~~^~~~
./Main.cpp:43:20: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | for(ll i = 1;i < ans.size();i++){
| ~~^~~~~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 500 / 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 | 3412 KiB |
| 01_random_00.txt | AC | 10 ms | 5544 KiB |
| 01_random_01.txt | AC | 10 ms | 5604 KiB |
| 01_random_02.txt | AC | 10 ms | 5496 KiB |
| 01_random_03.txt | AC | 10 ms | 5544 KiB |
| 01_random_04.txt | AC | 10 ms | 5540 KiB |
| 01_random_05.txt | AC | 10 ms | 5536 KiB |
| 01_random_06.txt | AC | 10 ms | 5544 KiB |
| 01_random_07.txt | AC | 10 ms | 5544 KiB |
| 01_random_08.txt | AC | 10 ms | 5520 KiB |
| 01_random_09.txt | AC | 10 ms | 5400 KiB |
| 01_random_10.txt | AC | 8 ms | 3556 KiB |
| 01_random_11.txt | AC | 8 ms | 3452 KiB |
| 01_random_12.txt | AC | 8 ms | 3496 KiB |