CSES - Harjoituskisa 7.1.2018 - Results
Submission details
Task:Keskiarvot
Sender:Uolevi
Submission time:2018-01-07 19:44:54 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.05 s1details
#20.07 s1details
#30.03 s1details
#40.04 s1details
#50.05 s1details
#60.13 s2details
#70.14 s2details
#80.17 s2details
#90.18 s2details
#100.14 s2details
#11--3details
#12--3details
#13--3details
#14--3details
#15--3details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:22:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1;i<v.size();i++){
               ^

Code

#include <bits/stdc++.h>
using namespace std;

double n;
double x;
double maxi;
double z;
double a;
vector<double> v = {0};
int main(){
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> x;
	//	cout << x << " ";
		v.push_back(v[i-1]+x);
	}
	//cout << v.size() << " " << n << "\n";
	for(auto i : v){
		cout << i << " ";
	}
	cout << "\n";
	for(int i=1;i<v.size();i++){
	//	cout << v[i] << "\n";
		maxi = 0;
		a=0;
		for(int j=0;j<i;j++){
			z = (v[i]-v[j])/(i-j);
		//	cout << z << " ";
			if(maxi < z){
		//		cout << maxi << " " << z << " " << j << " " << i <<  "\n";
				maxi = z;
				a = i-j;
			}
		}
		cout << a << " ";
	}
	
}

Test details

Test 1

Group: 1

Verdict:

input
100
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 ...

Test 2

Group: 1

Verdict:

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

correct output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

user output
0 1 2 4 6 9 12 16 20 25 30 36 ...

Test 3

Group: 1

Verdict:

input
100
1000000 999999 999998 999997 9...

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
0 1e+06 999999 2e+06 2e+06 2.9...

Test 4

Group: 1

Verdict:

input
100
4 1 6 9 4 793899 5 5 8 7 5 4 7...

correct output
1 2 1 1 2 1 2 3 4 5 6 7 8 9 10...

user output
0 4 1 10 10 14 793909 19 79391...

Test 5

Group: 1

Verdict:

input
100
442147 824215 62008 513740 542...

correct output
1 1 2 1 1 3 1 2 6 10 11 12 1 1...

user output
0 442147 824215 504155 1.33796...

Test 6

Group: 2

Verdict:

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

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 ...

Test 7

Group: 2

Verdict:

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

correct output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

user output
0 1 2 4 6 9 12 16 20 25 30 36 ...

Test 8

Group: 2

Verdict:

input
5000
1000000 999999 999998 999997 9...

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
0 1e+06 999999 2e+06 2e+06 2.9...

Test 9

Group: 2

Verdict:

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

correct output
1 2 3 4 1 2 7 1 1 2 3 4 5 6 1 ...

user output
0 7 5 13 6 22 7 23 13 33 21 40...

Test 10

Group: 2

Verdict:

input
5000
236071 202283 94200 149202 642...

correct output
1 2 3 4 1 1 2 3 5 1 2 1 9 10 1...

user output
0 236071 202283 330271 351485 ...

Test 11

Group: 3

Verdict:

input
100000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 12

Group: 3

Verdict:

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

correct output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

user output
(empty)

Test 13

Group: 3

Verdict:

input
100000
1000000 999999 999998 999997 9...

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 14

Group: 3

Verdict:

input
100000
4 10 3 2 235575 7 374394 4 4 5...

correct output
1 1 2 3 1 2 1 2 3 6 7 8 9 10 1...

user output
(empty)

Test 15

Group: 3

Verdict:

input
100000
243549 902542 256118 941342 41...

correct output
1 1 2 1 2 5 6 1 8 9 1 2 12 13 ...

user output
(empty)