Submission #19184892
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define x first
#define y second
#define bg begin()
#define ed end()
#define pb push_back
#define mp make_pair
#define sz(a) int((a).size())
#define R(i,n) for(int i(0);i<(n);++i)
#define L(i,n) for(int i((n)-1);i>=0;--i)
const int iinf=0x3f3f3f3f;
const ll linf=0x3f3f3f3f3f3f3f3f;
//Data
ll n;
//mylist
int l_n;
struct mylist{
int x; mylist *l,*r;
mylist(int x):x(x),l(NULL),r(NULL){}
}*be,*en;
//Function
void solve(ll n){
if(n==1) be=en=new mylist(l_n++);
else if(n&1) solve(n>>1),en->r=new mylist(l_n++),en->r->l=en,en=en->r;
else solve(n-1),be->l=new mylist(l_n++),be->l->r=be,be=be->l;
}
//Main
int main(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
cin>>n,solve(n);
cout<<l_n+100<<'\n';
for(mylist* i=be;i;i=i->r) cout<<i->x+1<<' ';
R(i,100) cout<<i+1<<' ';
cout<<'\n';
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Tautonym Puzzle |
| User | George1123 |
| Language | C++ (GCC 9.2.1) |
| Score | 1000 |
| Code Size | 987 Byte |
| Status | AC |
| Exec Time | 8 ms |
| Memory | 3616 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 1000 / 1000 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_example_01.txt, 00_example_02.txt |
| All | 00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_example_01.txt | AC | 8 ms | 3528 KiB |
| 00_example_02.txt | AC | 2 ms | 3440 KiB |
| 01.txt | AC | 2 ms | 3448 KiB |
| 02.txt | AC | 2 ms | 3540 KiB |
| 03.txt | AC | 3 ms | 3504 KiB |
| 04.txt | AC | 2 ms | 3508 KiB |
| 05.txt | AC | 2 ms | 3504 KiB |
| 06.txt | AC | 2 ms | 3540 KiB |
| 07.txt | AC | 5 ms | 3468 KiB |
| 08.txt | AC | 2 ms | 3616 KiB |
| 09.txt | AC | 2 ms | 3476 KiB |
| 10.txt | AC | 2 ms | 3456 KiB |
| 11.txt | AC | 2 ms | 3476 KiB |
| 12.txt | AC | 2 ms | 3460 KiB |
| 13.txt | AC | 6 ms | 3548 KiB |
| 14.txt | AC | 2 ms | 3544 KiB |
| 15.txt | AC | 2 ms | 3472 KiB |
| 16.txt | AC | 3 ms | 3520 KiB |
| 17.txt | AC | 2 ms | 3500 KiB |
| 18.txt | AC | 2 ms | 3504 KiB |
| 19.txt | AC | 2 ms | 3540 KiB |
| 20.txt | AC | 2 ms | 3504 KiB |
| 21.txt | AC | 2 ms | 3464 KiB |
| 22.txt | AC | 2 ms | 3536 KiB |
| 23.txt | AC | 2 ms | 3416 KiB |
| 24.txt | AC | 2 ms | 3460 KiB |
| 25.txt | AC | 2 ms | 3444 KiB |
| 26.txt | AC | 2 ms | 3508 KiB |
| 27.txt | AC | 3 ms | 3476 KiB |
| 28.txt | AC | 2 ms | 3508 KiB |
| 29.txt | AC | 2 ms | 3472 KiB |
| 30.txt | AC | 2 ms | 3444 KiB |