Code Submission Evaluation System Login

Datatähti 2018 alku

Start:2017-10-02 00:00:00
End:2017-10-16 00:00:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - Datatähti 2018 alku - Results
History
2017-10-11 09:53:3949
2017-10-11 09:52:1549
2017-10-11 09:51:35
2017-10-11 09:47:447
2017-10-11 09:46:36
2017-10-11 09:45:36
2017-10-11 02:31:0549
2017-10-11 02:29:5622
2017-10-11 02:26:3649
2017-10-11 02:17:0049
2017-10-11 02:16:2449
2017-10-11 02:13:0949
2017-10-11 02:07:190
2017-10-11 01:52:1649
2017-10-11 01:51:3949
2017-10-11 01:49:1449
2017-10-11 01:34:060
2017-10-11 01:32:1449
2017-10-11 01:31:3049
2017-10-11 01:30:1549
2017-10-11 01:29:0549
2017-10-11 01:17:1349
2017-10-11 01:13:4842
2017-10-11 01:07:330
2017-10-11 00:59:280
2017-10-11 00:57:1342
2017-10-10 23:35:2049
2017-10-10 23:33:540
2017-10-10 23:32:200
2017-10-10 22:51:1149
2017-10-10 22:50:3249
2017-10-10 22:49:5149
2017-10-10 22:48:0549
2017-10-10 22:46:3349
2017-10-10 22:31:4922
2017-10-10 22:24:1022
2017-10-10 22:22:4622
2017-10-10 15:47:0349
2017-10-10 15:46:2249
2017-10-10 15:45:4049
2017-10-10 15:18:5049
2017-10-10 15:18:3049
2017-10-10 15:03:0549
2017-10-10 15:01:5549
2017-10-10 13:31:1349
2017-10-10 00:31:0349
2017-10-10 00:27:5422
2017-10-10 00:23:587
2017-10-10 00:20:1122
2017-10-09 22:11:4549
2017-10-09 22:10:1934
2017-10-09 22:05:2749
2017-10-09 21:55:2249
2017-10-09 21:54:4249
2017-10-09 21:54:0649
2017-10-09 21:53:1949
2017-10-09 21:52:4149
2017-10-09 21:52:0449
2017-10-09 21:51:280
2017-10-09 21:50:4349
2017-10-09 21:50:19
2017-10-09 21:49:36
2017-10-09 21:45:4122
2017-10-09 21:31:5149
2017-10-09 21:01:5649
2017-10-09 21:01:0149
2017-10-09 20:53:0349
2017-10-09 20:33:2049
2017-10-09 20:31:5749
2017-10-09 20:09:3549
2017-10-09 20:00:4149
2017-10-09 19:59:4249
2017-10-09 19:56:4949
2017-10-08 16:38:0249
2017-10-08 16:35:0122
2017-10-08 16:32:0715
2017-10-08 16:30:257
2017-10-08 16:28:587
2017-10-08 15:12:4549
2017-10-06 17:17:3849
2017-10-06 17:14:5142
2017-10-06 16:48:3249
2017-10-06 16:47:4349
2017-10-06 16:47:0049
2017-10-06 16:39:0049
2017-10-06 09:05:4649
2017-10-06 09:04:12
2017-10-06 08:58:4427
2017-10-06 08:56:1449
2017-10-06 08:55:1949
2017-10-06 08:54:1849
2017-10-06 08:48:1749
2017-10-06 08:47:3249
2017-10-05 22:47:0549
2017-10-05 22:37:1149
2017-10-05 22:35:1049
2017-10-05 22:34:1149
2017-10-05 22:32:1349
2017-10-05 22:28:5849
2017-10-05 22:26:3349
2017-10-05 22:23:2122
2017-10-05 22:22:1415
2017-10-05 22:15:1227
2017-10-05 22:11:0942
2017-10-05 22:10:29
2017-10-05 21:59:4849
2017-10-05 21:39:290
2017-10-05 21:36:250
2017-10-05 00:01:020
2017-10-05 00:00:280
Task:Bittijono
Sender:SeveriK
Submission time:2017-10-11 09:53:39
Language:C++
Status:READY
Score:49

Feedback

groupverdictscore
#1ACCEPTED7
#2ACCEPTED15
#3ACCEPTED27
#4TIME LIMIT EXCEEDED0

Test results

testverdicttime (s)group
#1ACCEPTED0.05 / 1.001details
#2ACCEPTED0.05 / 1.001details
#3ACCEPTED0.04 / 1.001details
#4ACCEPTED0.05 / 1.001details
#5ACCEPTED0.06 / 1.001details
#6ACCEPTED0.07 / 1.001details
#7ACCEPTED0.05 / 1.001details
#8ACCEPTED0.05 / 1.001details
#9ACCEPTED0.07 / 1.001details
#10ACCEPTED0.05 / 1.001details
#11ACCEPTED0.07 / 1.002details
#12ACCEPTED0.06 / 1.002details
#13ACCEPTED0.05 / 1.002details
#14ACCEPTED0.05 / 1.002details
#15ACCEPTED0.05 / 1.002details
#16ACCEPTED0.07 / 1.002details
#17ACCEPTED0.04 / 1.002details
#18ACCEPTED0.07 / 1.002details
#19ACCEPTED0.07 / 1.002details
#20ACCEPTED0.07 / 1.002details
#21ACCEPTED0.05 / 1.003details
#22ACCEPTED0.06 / 1.003details
#23ACCEPTED0.09 / 1.003details
#24ACCEPTED0.05 / 1.003details
#25ACCEPTED0.06 / 1.003details
#26ACCEPTED0.05 / 1.003details
#27ACCEPTED0.05 / 1.003details
#28ACCEPTED0.08 / 1.003details
#29ACCEPTED0.06 / 1.003details
#30ACCEPTED0.06 / 1.003details
#31TIME LIMIT EXCEEDED-- / 1.004details
#32TIME LIMIT EXCEEDED-- / 1.004details
#33TIME LIMIT EXCEEDED-- / 1.004details
#34TIME LIMIT EXCEEDED-- / 1.004details
#35TIME LIMIT EXCEEDED-- / 1.004details
#36TIME LIMIT EXCEEDED-- / 1.004details
#37TIME LIMIT EXCEEDED-- / 1.004details
#38TIME LIMIT EXCEEDED-- / 1.004details
#39TIME LIMIT EXCEEDED-- / 1.004details
#40ACCEPTED0.89 / 1.004details

Code

/*
#include <iostream>
#include <fstream>
#include <string>
#include <vector>

using namespace std;

int main()
{
	string rows[10];
	for (int i = 0; i < 10; i++)
	{
		for (int o = 0; o < 10; o++)
		{
			int n = 0;
			if (i < 10 / 2)
			{
				n = i + o;
			}
			else if (i < 9)
			{
				n = i + o + 1;
			}
			else
			{
				n = i + o + 6;
			}
			while (n > 9)
			{
				n -= 10;
			}
			rows[i] += to_string(n);

			if (i < 9)
			{
				n = o - i;
			}
			else
			{
				n = o - i;
			}
			while (n < 0)
			{
				n += 10;
			}

			if (n == 0)
			{
				rows[i] += "A";
			}
			else if (n == 1)
			{
				rows[i] += "B";
			}
			else if (n == 2)
			{
				rows[i] += "C";
			}
			else if (n == 3)
			{
				rows[i] += "D";
			}
			else if (n == 4)
			{
				rows[i] += "E";
			}
			else if (n == 5)
			{
				rows[i] += "F";
			}
			else if (n == 6)
			{
				rows[i] += "G";
			}
			else if (n == 7)
			{
				rows[i] += "H";
			}
			else if (n == 8)
			{
				rows[i] += "I";
			}
			else if (n == 9)
			{
				rows[i] += "J";
			}
			if (o != 9)
			{
				rows[i] += " ";
			}
		}
		std::cout << rows[i] << "\n";
	}

	ofstream myfile;
	myfile.open("Eppapeli.txt");
	if (myfile.is_open())
	{
		for (int i = 0; i < 10; i++)
		{
			if (i != 10 - 1)
			{
				myfile << rows[i] + "\n";
			}
			else
			{
				myfile << rows[i];
			}
		}
		myfile.close();
	}

	int a;
	std::cin >> a;

	return 0;
}
}*/

#include <iostream>
#include <string>
#include <vector>
#include <bitset>

using namespace std;

int main()
{
	const int MAX_CHAR = 64;

	unsigned int subCount = 0;
	string bitSeq = "1";

	unsigned int k = 0;
	std::cin >> k;

	if (k == 0)
	{
		std::cout << "\n";
	}
	else if (k == 1)
	{
		std::cout << 0 << "\n";
	}
	else
	{
		if (k > 999)
		{

			unsigned int l = 1;
			while (subCount < k)
			{
				if (l % 2)
				{
					bitSeq += '0';
				}
				else
				{
					bitSeq += '1';
				}
				l++;
				vector<unsigned int>last(MAX_CHAR, -1);

				const unsigned int n = bitSeq.length();

				unsigned int* dp = new unsigned int[n + 1];
				dp[0] = 1;

				for (unsigned int o = 1; o <= n; o++)
				{
					dp[o] = 2 * dp[o - 1];

					if (last[bitSeq[o - 1]] != (unsigned int) - 1)
					{
						dp[o] = dp[o] - dp[last[bitSeq[o - 1]]];
					}

					last[bitSeq[o - 1]] = (o - 1);
				}
				vector<unsigned int>().swap(last);
				subCount = dp[n] - 1;
				dp = 0;
			}
			l--;
			if (bitSeq[l] == '1')
			{
				l--;
			}
			while (subCount > k)
			{
				bitSeq[l] = '1';

				vector<unsigned int>last(MAX_CHAR, -1);

				const unsigned int n = bitSeq.length();

				unsigned int* dp = new unsigned int[n + 1];
				dp[0] = 1;

				for (unsigned int o = 1; o <= n; o++)
				{
					dp[o] = 2 * dp[o - 1];

					if (last[bitSeq[o - 1]] != (unsigned int) - 1)
					{
						dp[o] = dp[o] - dp[last[bitSeq[o - 1]]];
					}

					last[bitSeq[o - 1]] = (o - 1);
				}
				vector<unsigned int>().swap(last);
				subCount = dp[n] - 1;
				l -= 2;
			}

			subCount = 0;
		}

		unsigned int l = bitSeq.length();
		while (subCount != k)
		{
			for (unsigned int b = l - 1; b >= 0; b--)
			{
				if (bitSeq[b] != '1')
				{
					bitSeq[b] = '1';
					for (unsigned int c = b + 1; c < l; c++)
					{
						bitSeq[c] = '0';
					}
					break;
				}
				else if (b == 0)
				{
					bitSeq = "1";
					bitSeq += string(l, '0');
					l++;
					break;
				}
			}

			const unsigned int n = l;

			vector<unsigned int>last(MAX_CHAR, -1);

			unsigned int* dp = new unsigned int[n + 1];
			dp[0] = 1;

			for (unsigned int o = 1; o <= n; o++)
			{
				dp[o] = 2 * dp[o - 1];

				if (last[bitSeq[o - 1]] != (unsigned int) - 1)
				{
					dp[o] = dp[o] - dp[last[bitSeq[o - 1]]];
				}

				last[bitSeq[o - 1]] = (o - 1);
			}
			vector<unsigned int>().swap(last);
			subCount = dp[n] - 1;
		}
		std::cout << bitSeq << "\n";
	}

	unsigned int a;
	std::cin >> a;
	return 0;
}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
1
view   save

correct output
1
view   save

user output
0
view   save

Test 2

Group: 1

Verdict: ACCEPTED

input
2
view   save

correct output
11
view   save

user output
11
view   save

Test 3

Group: 1

Verdict: ACCEPTED

input
3
view   save

correct output
10
view   save

user output
10
view   save

Test 4

Group: 1

Verdict: ACCEPTED

input
4
view   save

correct output
1111
view   save

user output
1111
view   save

Test 5

Group: 1

Verdict: ACCEPTED

input
5
view   save

correct output
110
view   save

user output
100
view   save

Test 6

Group: 1

Verdict: ACCEPTED

input
6
view   save

correct output
101
view   save

user output
101
view   save

Test 7

Group: 1

Verdict: ACCEPTED

input
7
view   save

correct output
1110
view   save

user output
1000
view   save

Test 8

Group: 1

Verdict: ACCEPTED

input
8
view   save

correct output
1100
view   save

user output
1100
view   save

Test 9

Group: 1

Verdict: ACCEPTED

input
9
view   save

correct output
1101
view   save

user output
1011
view   save

Test 10

Group: 1

Verdict: ACCEPTED

input
10
view   save

correct output
1001
view   save

user output
1001
view   save

Test 11

Group: 2

Verdict: ACCEPTED

input
38
view   save

correct output
1101011
view   save

user output
1101011
view   save

Test 12

Group: 2

Verdict: ACCEPTED

input
13
view   save

correct output
11011
view   save

user output
11011
view   save

Test 13

Group: 2

Verdict: ACCEPTED

input
90
view   save

correct output
111001010
view   save

user output
100100010
view   save

Test 14

Group: 2

Verdict: ACCEPTED

input
25
view   save

correct output
110010
view   save

user output
101100
view   save

Test 15

Group: 2

Verdict: ACCEPTED

input
82
view   save

correct output
111001101
view   save

user output
100010011
view   save

Test 16

Group: 2

Verdict: ACCEPTED

input
94
view   save

correct output
1100011110
view   save

user output
1000011100
view   save

Test 17

Group: 2

Verdict: ACCEPTED

input
100
view   save

correct output
1111001001
view   save

user output
1001001111
view   save

Test 18

Group: 2

Verdict: ACCEPTED

input
99
view   save

correct output
110010010
view   save

user output
100011010
view   save

Test 19

Group: 2

Verdict: ACCEPTED

input
98
view   save

correct output
110110010
view   save

user output
100111010
view   save

Test 20

Group: 2

Verdict: ACCEPTED

input
92
view   save

correct output
100110001
view   save

user output
100011001
view   save

Test 21

Group: 3

Verdict: ACCEPTED

input
1666
view   save

correct output
101101100100101
view   save

user output
101010101110110
view   save

Test 22

Group: 3

Verdict: ACCEPTED

input
897
view   save

correct output
11101001101010
view   save

user output
10100010110100
view   save

Test 23

Group: 3

Verdict: ACCEPTED

input
4466
view   save

correct output
111101010110100101
view   save

user output
101001001110001011
view   save

Test 24

Group: 3

Verdict: ACCEPTED

input
4240
view   save

correct output
11011001011010101
view   save

user output
10101011010011011
view   save

Test 25

Group: 3

Verdict: ACCEPTED

input
3089
view   save

correct output
1011001010100101
view   save

user output
1011001010100101
view   save

Test 26

Group: 3

Verdict: ACCEPTED

input
4697
view   save

correct output
11010101101010110
view   save

user output
10101101101101010
view   save

Test 27

Group: 3

Verdict: ACCEPTED

input
4608
view   save

correct output
11010110101001010
view   save

user output
10101101010010100
view   save

Test 28

Group: 3

Verdict: ACCEPTED

input
4625
view   save

correct output
111011001100101001
view   save

user output
100010101110110110
view   save

Test 29

Group: 3

Verdict: ACCEPTED

input
4611
view   save

correct output
11010101010101100
view   save

user output
10101101011010100
view   save

Test 30

Group: 3

Verdict: ACCEPTED

input
4917
view   save

correct output
10110100101010110
view   save

user output
10110100101010110
view   save

Test 31

Group: 4

Verdict: TIME LIMIT EXCEEDED

input
178555
view   save

correct output
1011010110110101010110110
view   save

user output
(no output)
view   save

Test 32

Group: 4

Verdict: TIME LIMIT EXCEEDED

input
864856
view   save

correct output
10111010110110100100101010010
view   save

user output
(no output)
view   save

Test 33

Group: 4

Verdict: TIME LIMIT EXCEEDED

input
112146
view   save

correct output
1101110101011001100100110
view   save

user output
(no output)
view   save

Test 34

Group: 4

Verdict: TIME LIMIT EXCEEDED

input
741124
view   save

correct output
1011010011010101100101011010
view   save

user output
(no output)
view   save

Test 35

Group: 4

Verdict: TIME LIMIT EXCEEDED

input
511902
view   save

correct output
1011010100011010100101001110
view   save

user output
(no output)
view   save

Test 36

Group: 4

Verdict: TIME LIMIT EXCEEDED

input
920019
view   save

correct output
11100100101101010101001101010
view   save

user output
(no output)
view   save

Test 37

Group: 4

Verdict: TIME LIMIT EXCEEDED

input
933943
view   save

correct output
10101011010100100110100111001
view   save

user output
(no output)
view   save

Test 38

Group: 4

Verdict: TIME LIMIT EXCEEDED

input
973410
view   save

correct output
1011010101011010101010101001
view   save

user output
(no output)
view   save

Test 39

Group: 4

Verdict: TIME LIMIT EXCEEDED

input
954943
view   save

correct output
10110110010011010100100110101
view   save

user output
(no output)
view   save

Test 40

Group: 4

Verdict: ACCEPTED

input
911674
view   save

correct output
1010110010110101010101010110
view   save

user output
1010110010110101010101010110
view   save