Submission #74529396


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vec vector
#define pll pair<ll,ll>
const ll N = 1e5 + 10;
const ll mod = 1e9 + 7;

ll b[40],c[40];
vec<ll> a;

void dfs(ll x){
	if(x > 1e9) return ;
	a.push_back(x);
	for(int i = 0 ; i <= 32 ; i++){
		dfs(x * c[i] + b[i]);
	}
}

void solve(){
	ll n;cin >> n;
	b[0] = 1;
	for(int i = 1 ; i <= 32 ; i++){
		b[i] = b[i - 1] * 2;
	}
	for(int i = 0 ; i <= 32 ; i++){
		ll v = b[i];
		c[i] = 1;
		while(v > 0){
			v /= 10;
			c[i] *= 10;
		}
	}
	dfs(0);
	sort(a.begin(),a.end());
	a.erase(unique(a.begin(),a.end()),a.end());
	cout << a[n] << "\n";
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);cout.tie(nullptr);
	int T = 1;
//  	cin >> T;
	while(T--){
		solve();
	}
    return 0;
}

Submission Info

Submission Time
Task D - Concat Power of 2
User Xiao_Zhang
Language C++23 (GCC 15.2.0)
Score 400
Code Size 817 Byte
Status AC
Exec Time 108 ms
Memory 19984 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 28
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_min_01.txt, 01_min_02.txt, 01_min_03.txt, 01_min_04.txt, 01_min_05.txt, 02_small_01.txt, 02_small_02.txt, 02_small_03.txt, 02_small_04.txt, 02_small_05.txt, 03_medium_01.txt, 03_medium_02.txt, 03_medium_03.txt, 03_medium_04.txt, 03_medium_05.txt, 04_large_01.txt, 04_large_02.txt, 04_large_03.txt, 04_large_04.txt, 04_large_05.txt, 05_max_01.txt, 05_max_02.txt, 05_max_03.txt, 05_max_04.txt, 05_max_05.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 106 ms 19752 KiB
00_sample_02.txt AC 105 ms 19856 KiB
00_sample_03.txt AC 106 ms 19984 KiB
01_min_01.txt AC 108 ms 19924 KiB
01_min_02.txt AC 107 ms 19948 KiB
01_min_03.txt AC 107 ms 19836 KiB
01_min_04.txt AC 106 ms 19852 KiB
01_min_05.txt AC 107 ms 19852 KiB
02_small_01.txt AC 106 ms 19860 KiB
02_small_02.txt AC 105 ms 19840 KiB
02_small_03.txt AC 105 ms 19896 KiB
02_small_04.txt AC 105 ms 19844 KiB
02_small_05.txt AC 106 ms 19844 KiB
03_medium_01.txt AC 105 ms 19928 KiB
03_medium_02.txt AC 104 ms 19836 KiB
03_medium_03.txt AC 105 ms 19856 KiB
03_medium_04.txt AC 104 ms 19932 KiB
03_medium_05.txt AC 104 ms 19832 KiB
04_large_01.txt AC 104 ms 19792 KiB
04_large_02.txt AC 106 ms 19912 KiB
04_large_03.txt AC 106 ms 19876 KiB
04_large_04.txt AC 105 ms 19880 KiB
04_large_05.txt AC 106 ms 19844 KiB
05_max_01.txt AC 104 ms 19836 KiB
05_max_02.txt AC 105 ms 19840 KiB
05_max_03.txt AC 105 ms 19840 KiB
05_max_04.txt AC 105 ms 19780 KiB
05_max_05.txt AC 104 ms 19840 KiB