Code Submission Evaluation System Login

Datatähti 2017 loppu

Start:2017-01-19 12:15:00
End:2017-01-19 17:15:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - Datatähti 2017 loppu - Results
History
2017-01-19 17:11:5421
2017-01-19 17:11:4721
2017-01-19 17:10:510
2017-01-19 17:10:260
2017-01-19 17:09:56
2017-01-19 16:57:160
2017-01-19 16:56:240
2017-01-19 16:54:470
2017-01-19 16:52:050
2017-01-19 16:48:070
2017-01-19 16:47:110
2017-01-19 16:45:560
2017-01-19 16:45:210
2017-01-19 16:44:410
2017-01-19 15:01:090
2017-01-19 14:59:350
2017-01-19 14:58:510
2017-01-19 14:34:020
Task:Ohjelma
Sender:kapesu8
Submission time:2017-01-19 17:11:54
Language:C++
Status:READY
Score:21

Feedback

groupverdictscore
#1ACCEPTED21
#2TIME LIMIT EXCEEDED0
#3TIME LIMIT EXCEEDED0

Test results

testverdicttime (s)group
#1ACCEPTED0.04 / 0.501details
#2ACCEPTED0.04 / 0.501details
#3ACCEPTED0.03 / 0.501details
#4ACCEPTED0.04 / 0.501details
#5ACCEPTED0.04 / 0.501details
#6ACCEPTED0.03 / 0.501details
#7ACCEPTED0.03 / 0.501details
#8ACCEPTED0.03 / 0.501details
#9ACCEPTED0.04 / 0.501details
#10ACCEPTED0.05 / 0.501details
#11TIME LIMIT EXCEEDED-- / 0.502details
#12TIME LIMIT EXCEEDED-- / 0.502details
#13TIME LIMIT EXCEEDED-- / 0.502details
#14TIME LIMIT EXCEEDED-- / 0.502details
#15TIME LIMIT EXCEEDED-- / 0.502details
#16TIME LIMIT EXCEEDED-- / 0.502details
#17TIME LIMIT EXCEEDED-- / 0.502details
#18TIME LIMIT EXCEEDED-- / 0.502details
#19TIME LIMIT EXCEEDED-- / 0.502details
#20TIME LIMIT EXCEEDED-- / 0.502details
#21TIME LIMIT EXCEEDED-- / 0.503details
#22RUNTIME ERROR0.42 / 0.503details
#23TIME LIMIT EXCEEDED-- / 0.503details
#24TIME LIMIT EXCEEDED-- / 0.503details
#25RUNTIME ERROR0.41 / 0.503details
#26TIME LIMIT EXCEEDED-- / 0.503details
#27TIME LIMIT EXCEEDED-- / 0.503details
#28TIME LIMIT EXCEEDED-- / 0.503details
#29RUNTIME ERROR0.49 / 0.503details
#30TIME LIMIT EXCEEDED-- / 0.503details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:60:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0;i < solutions.size();i++)
                                   ^

Code

#include <iostream>
#include <vector>
#include <algorithm>


int min_level = 0x00FFFFFF;

struct btree
{
	btree* parent;
	btree* right;
	btree* left;
	int rl;
	int level;
	int value;
};

btree* start_node;
std::vector<btree*> solutions;
std::vector<unsigned char> reversed_steps;

void build_steps(btree* node,int req)
{
	if(node->value == req)
	{
		solutions.push_back(node);
		min_level = node->level;
		return;
	}
	if(node->value > req || node->level >= min_level)
		return;
	node->right = new btree;
	node->left = new btree;
	node->right->value = node->value * 2;
	node->right->rl = 1;
	node->left->rl = 0;
	node->left->value = node->value + 3;
	node->right->level = node->left->level = node->level + 1;
	node->right->parent = node->left->parent = node;
	build_steps(node->right,req);
	build_steps(node->left,req);
}


int main()
{
	int n;
	std::cin >> n;
	/*if(n % 3 == 0)
	{
		std::cout << '0';
		return 0;
	}*/
	start_node = new btree;
	start_node->value = 1;
	start_node->level = 0;
	build_steps(start_node,n);
	btree* quickest = (btree*)NULL;
	int quickest_steps = 0x00FFFFFFF;
	for(int i = 0;i < solutions.size();i++)
	{
		if(solutions[i]->level < quickest_steps)
		{
			quickest = solutions[i];
			quickest_steps = solutions[i]->level;
		}
	}
	if(quickest != NULL)
		reversed_steps.push_back(2); 
	btree* next = quickest;
	while(next != start_node && next != NULL)
	{
		if(next->rl == 1)
			reversed_steps.push_back(1);
		else
			reversed_steps.push_back(0);
		next = next->parent;
	}
	if(solutions.size() != 0)
		std::cout << reversed_steps.size() << '\n';
	for(int i = reversed_steps.size()-1;i >= 0;i--)
	{
		if(reversed_steps[i] == 0)
			std::cout << "ADD\n";
		else if(reversed_steps[i] == 1)
			std::cout << "MUL\n";
		else
			std::cout << "END\n";
	}
	if(solutions.size() == 0)
		std::cout << '0';
	return 0;
}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
58

view   save

correct output
8
MUL
ADD
MUL
ADD
...
view   save

user output
8
MUL
ADD
MUL
ADD
...
view   save

Test 2

Group: 1

Verdict: ACCEPTED

input
72

view   save

correct output
0

view   save

user output
0

view   save

Test 3

Group: 1

Verdict: ACCEPTED

input
83

view   save

correct output
8
MUL
ADD
MUL
MUL
...
view   save

user output
8
MUL
ADD
MUL
MUL
...
view   save

Test 4

Group: 1

Verdict: ACCEPTED

input
53

view   save

correct output
8
ADD
MUL
ADD
MUL
...
view   save

user output
8
ADD
MUL
ADD
MUL
...
view   save

Test 5

Group: 1

Verdict: ACCEPTED

input
100

view   save

correct output
8
ADD
MUL
ADD
MUL
...
view   save

user output
8
ADD
MUL
ADD
MUL
...
view   save

Test 6

Group: 1

Verdict: ACCEPTED

input
64

view   save

correct output
6
ADD
MUL
MUL
MUL
...
view   save

user output
6
ADD
MUL
MUL
MUL
...
view   save

Test 7

Group: 1

Verdict: ACCEPTED

input
84

view   save

correct output
0

view   save

user output
0

view   save

Test 8

Group: 1

Verdict: ACCEPTED

input
60

view   save

correct output
0

view   save

user output
0

view   save

Test 9

Group: 1

Verdict: ACCEPTED

input
51

view   save

correct output
0

view   save

user output
0

view   save

Test 10

Group: 1

Verdict: ACCEPTED

input
77

view   save

correct output
9
ADD
ADD
MUL
ADD
...
view   save

user output
9
ADD
ADD
MUL
ADD
...
view   save

Test 11

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
941694

view   save

correct output
0

view   save

user output
(empty)

Test 12

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
905674

view   save

correct output
30
MUL
ADD
MUL
ADD
...
view   save

user output
(empty)

Test 13

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
908426

view   save

correct output
29
ADD
MUL
ADD
MUL
...
view   save

user output
(empty)

Test 14

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
960500

view   save

correct output
31
ADD
ADD
MUL
MUL
...
view   save

user output
(empty)

Test 15

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
902101

view   save

correct output
27
MUL
ADD
MUL
ADD
...
view   save

user output
(empty)

Test 16

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
994208

view   save

correct output
27
ADD
ADD
MUL
MUL
...
view   save

user output
(empty)

Test 17

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
923538

view   save

correct output
0

view   save

user output
(empty)

Test 18

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
950287

view   save

correct output
24
MUL
ADD
MUL
ADD
...
view   save

user output
(empty)

Test 19

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
950516

view   save

correct output
29
ADD
ADD
MUL
MUL
...
view   save

user output
(empty)

Test 20

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
921882

view   save

correct output
0

view   save

user output
(empty)

Test 21

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
933942296856681219

view   save

correct output
0

view   save

user output
(empty)

Test 22

Group: 3

Verdict: RUNTIME ERROR

input
955775764385016720

view   save

correct output
0

view   save

user output
(empty)

Test 23

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
981578916796073406

view   save

correct output
0

view   save

user output
(empty)

Test 24

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
927875200723222396

view   save

correct output
94
MUL
ADD
MUL
MUL
...
view   save

user output
(empty)

Test 25

Group: 3

Verdict: RUNTIME ERROR

input
990125206148420558

view   save

correct output
84
ADD
MUL
ADD
MUL
...
view   save

user output
(empty)

Test 26

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
964804802247123102

view   save

correct output
0

view   save

user output
(empty)

Test 27

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
996610423667404231

view   save

correct output
96
MUL
ADD
MUL
ADD
...
view   save

user output
(empty)

Test 28

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
948665008088793691

view   save

correct output
86
MUL
ADD
MUL
ADD
...
view   save

user output
(empty)

Test 29

Group: 3

Verdict: RUNTIME ERROR

input
969397787818953279

view   save

correct output
0

view   save

user output
(empty)

Test 30

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
918471787211371085

view   save

correct output
90
ADD
MUL
ADD
MUL
...
view   save

user output
(empty)