CSES - Harjoituskisa 14.1.2018 - Results
Submission details
Task:Alitaulukot
Sender:Nanohenry
Submission time:2018-01-14 21:12:34 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
Test results
testverdicttimegroup
#10.05 s1details
#2--2details

Code

#include <iostream>

using namespace std;

unsigned long getT(unsigned long val) {
	unsigned long sum = 0;
	for (unsigned long i = 1; i <= val; i++) {
		sum += i;
	}
	return sum;
}

int main() {
	unsigned long n;
	cin >> n;
	//unsigned long t[n];
	unsigned long sum = 0;
	for (unsigned long i = 0; i < n; i++) {
		unsigned long tmp;
		cin >> tmp;
		//t[i] = tmp;
		//sum += tmp;
		sum += getT(tmp);
	}
	/*for (unsigned long length = 2; length <= n; length++) {
		for (unsigned long i = 0; i < n - (length - 1); i++) {
			for (unsigned long j = i; j < i + length; j++) {
				sum += t[j];
			}
		}
	}*/
	cout << (sum * 2) % 1000000007;
	//while (1);
}

Test details

Test 1

Group: 1

Verdict:

input
100
72 66 50 11 3 15 68 45 79 11 9...

correct output
9437440

user output
377250

Test 2

Group: 2

Verdict:

input
100000
483398076 227177515 705421329 ...

correct output
179178131

user output
(empty)