Submission #74635058


Source Code Expand

#include <iostream>
#include <string>
#include <vector>
#include <set>

using namespace std;

void dfs(string& curr, vector<string>& pows, set<int>& res)
{
	for (string& add : pows)
	{
		if (curr.size() + add.size() < 10)
		{
			curr += add;
			res.insert(stoi(curr));
			dfs(curr, pows, res);
			curr.erase(curr.size() - add.size(), add.size());
		}
	}
}

int main(int argc, char *argv[])
{
	vector<string> pows{};
	for (int i = 0; i < 30; ++i)
	{
		pows.push_back(to_string(1 << i));
	}
	set<int> res{};
	string curr = "";
	dfs(curr, pows, res);
	vector<int> a(res.begin(), res.end());
	int n;
	cin >> n;
	cout << a[n - 1] << '\n';
	return 0;
}

Submission Info

Submission Time
Task D - Concat Power of 2
User RomanLeshchuk
Language C++23 (GCC 15.2.0)
Score 400
Code Size 682 Byte
Status AC
Exec Time 332 ms
Memory 67340 KiB

Compile Error

./Main.cpp: In function 'int main(int, char**)':
./Main.cpp:22:14: warning: unused parameter 'argc' [-Wunused-parameter]
   22 | int main(int argc, char *argv[])
      |          ~~~~^~~~
./Main.cpp:22:26: warning: unused parameter 'argv' [-Wunused-parameter]
   22 | int main(int argc, char *argv[])
      |                    ~~~~~~^~~~~~

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 317 ms 67328 KiB
00_sample_02.txt AC 305 ms 67328 KiB
00_sample_03.txt AC 297 ms 67264 KiB
01_min_01.txt AC 294 ms 67196 KiB
01_min_02.txt AC 290 ms 67260 KiB
01_min_03.txt AC 290 ms 67268 KiB
01_min_04.txt AC 299 ms 67148 KiB
01_min_05.txt AC 306 ms 67284 KiB
02_small_01.txt AC 303 ms 66996 KiB
02_small_02.txt AC 296 ms 66992 KiB
02_small_03.txt AC 293 ms 66996 KiB
02_small_04.txt AC 298 ms 67232 KiB
02_small_05.txt AC 296 ms 67148 KiB
03_medium_01.txt AC 293 ms 67328 KiB
03_medium_02.txt AC 310 ms 67148 KiB
03_medium_03.txt AC 306 ms 67048 KiB
03_medium_04.txt AC 298 ms 67340 KiB
03_medium_05.txt AC 303 ms 67128 KiB
04_large_01.txt AC 305 ms 67268 KiB
04_large_02.txt AC 289 ms 67216 KiB
04_large_03.txt AC 310 ms 67340 KiB
04_large_04.txt AC 300 ms 67292 KiB
04_large_05.txt AC 298 ms 67284 KiB
05_max_01.txt AC 300 ms 67268 KiB
05_max_02.txt AC 294 ms 66996 KiB
05_max_03.txt AC 312 ms 67140 KiB
05_max_04.txt AC 332 ms 67292 KiB
05_max_05.txt AC 312 ms 66992 KiB