CSES - Datatähti 2020 loppu - Results
Submission details
Task:Riippuliito
Sender:Aaron Äärelä
Submission time:2020-02-09 13:37:15 +0200
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.01 s1, 2, 3details
#20.01 s1, 2, 3details
#30.01 s1, 2, 3details
#40.01 s1, 2, 3details
#50.01 s1, 2, 3details
#60.01 s1, 2, 3details
#70.01 s1, 2, 3details
#8--2, 3details
#9--2, 3details
#10--2, 3details
#11--2, 3details
#12--2, 3details
#13--2, 3details
#14--2, 3details
#150.02 s3details
#160.03 s3details
#170.04 s3details
#180.02 s3details
#190.04 s3details
#200.04 s3details
#210.04 s3details
#220.01 s1, 2, 3details
#230.01 s1, 2, 3details
#240.01 s1, 2, 3details
#250.01 s1, 2, 3details
#260.01 s1, 2, 3details
#270.01 s1, 2, 3details
#280.01 s1, 2, 3details
#290.01 s1, 2, 3details

Compiler report

input/code.cpp: In function 'int f(int)':
input/code.cpp:26:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < tt[k].size(); i++){
                 ~~^~~~~~~~~~~~~~

Code

#include <bits/stdc++.h>
using namespace std;
const int si = 1 << 17;
const int si2 = si / 2;
int t[si] = {};
vector<int> tt[si] = {};
int rakenna(int k){
	if(k >= si2) return t[k];
	t[k] = max(rakenna(2 * k), rakenna(2 * k + 1));
	return t[k];
}
int sum(int a, int b){
	a += si2;
	b += si2;
	int m = 0;
	while(a <= b){
		if(a % 2 == 1) m = max(m, t[a++]);
		if(b % 2 == 0) m = max(m, t[b--]);
		a /= 2;
		b /= 2;
	}
	return m;
}
int f(int k){
	int m = 0;
	for(int i = 0; i < tt[k].size(); i++){
		m = max(m, f(tt[k][i]));
	}
	return m;
}
int main(){
	int n;
	cin >>n;
	t[0] = 0;
	int m = 0;
	for(int i = 0; i < n; i++){
		cin >> t[i + si2];
		if(t[i + si2] > t[m + si2]) m = i;
	}
	rakenna(1);
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			if(i == j) continue;
			if(i > j){
				int s = sum(j, i - 1);
				if(s < t[i + si]) tt[i].push_back(j);
			}
			else {
				int s = sum(i + 1, j);
				if(s < t[i + si]) tt[i].push_back(j);
			}
		}
	}
	int d = f(m);
	cout << d << '\n';
	return 0;
}

Test details

Test 1

Group: 1, 2, 3

Verdict:

input
10
1 1 1 1 1 1 1 1 1 1

correct output
1

user output
0

Test 2

Group: 1, 2, 3

Verdict:

input
10
1 2 3 4 5 6 7 8 9 10

correct output
10

user output
0

Test 3

Group: 1, 2, 3

Verdict:

input
10
10 9 8 7 6 5 4 3 2 1

correct output
10

user output
0

Test 4

Group: 1, 2, 3

Verdict:

input
10
10 9 6 10 10 3 6 7 6 5

correct output
4

user output
0

Test 5

Group: 1, 2, 3

Verdict:

input
10
51 90 27 98 85 47 14 55 82 52

correct output
6

user output
0

Test 6

Group: 1, 2, 3

Verdict:

input
10
9 65 90 86 45 52 52 95 40 85

correct output
5

user output
0

Test 7

Group: 1, 2, 3

Verdict:

input
10
3 46 77 16 59 32 22 41 87 89

correct output
7

user output
0

Test 8

Group: 2, 3

Verdict:

input
5000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
1

user output
(empty)

Test 9

Group: 2, 3

Verdict:

input
5000
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

correct output
5000

user output
(empty)

Test 10

Group: 2, 3

Verdict:

input
5000
5000 4999 4998 4997 4996 4995 ...

correct output
5000

user output
(empty)

Test 11

Group: 2, 3

Verdict:

input
5000
10 8 10 5 4 9 2 9 10 10 1 2 7 ...

correct output
9

user output
(empty)

Test 12

Group: 2, 3

Verdict:

input
5000
655923386 310000737 281882248 ...

correct output
28

user output
(empty)

Test 13

Group: 2, 3

Verdict:

input
5000
123456789 123456790 123456791 ...

correct output
2706

user output
(empty)

Test 14

Group: 2, 3

Verdict:

input
5000
123456789 123456790 123456791 ...

correct output
5000

user output
(empty)

Test 15

Group: 3

Verdict:

input
200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
1

user output
(empty)

Test 16

Group: 3

Verdict:

input
200000
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

correct output
200000

user output
(empty)

Test 17

Group: 3

Verdict:

input
200000
200000 199999 199998 199997 19...

correct output
200000

user output
(empty)

Test 18

Group: 3

Verdict:

input
200000
4 7 8 3 3 10 3 4 2 6 10 8 5 8 ...

correct output
10

user output
(empty)

Test 19

Group: 3

Verdict:

input
200000
824527039 112439661 517794857 ...

correct output
43

user output
(empty)

Test 20

Group: 3

Verdict:

input
200000
123456789 123456790 123456791 ...

correct output
30764

user output
(empty)

Test 21

Group: 3

Verdict:

input
200000
123456789 123456790 123456791 ...

correct output
61367

user output
(empty)

Test 22

Group: 1, 2, 3

Verdict:

input
1
1

correct output
1

user output
0

Test 23

Group: 1, 2, 3

Verdict:

input
2
1 1

correct output
1

user output
0

Test 24

Group: 1, 2, 3

Verdict:

input
2
1 2

correct output
2

user output
0

Test 25

Group: 1, 2, 3

Verdict:

input
2
2 1

correct output
2

user output
0

Test 26

Group: 1, 2, 3

Verdict:

input
3
1 2 1

correct output
2

user output
0

Test 27

Group: 1, 2, 3

Verdict:

input
3
1 2 3

correct output
3

user output
0

Test 28

Group: 1, 2, 3

Verdict:

input
3
3 2 1

correct output
3

user output
0

Test 29

Group: 1, 2, 3

Verdict:

input
3
2 1 2

correct output
2

user output
0