CSES - Harjoituskisa 14.1.2018 - Results
Submission details
Task:Alitaulukot
Sender:tuomask
Submission time:2018-01-14 19:43:47 +0200
Language:C++
Status:READY
Result:15
Feedback
groupverdictscore
#1ACCEPTED15
#20
Test results
testverdicttimegroup
#1ACCEPTED0.05 s1details
#2--2details

Code

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll s=0;
ll m = 1000000007;
int main() {
  cin >> n;
  ll x[n];
  for (int i=0; i<n; i++) cin >> x[i];
  for (int i=0; i<n; i++) x[i] *= (n - i);
  for (int a=0; a<n; a++)
    for (int b=a; b<n; b++)
      s = (s + x[b]) % m;
  cout << s << "\n";
}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

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

correct output
9437440

user output
9437440

Test 2

Group: 2

Verdict:

input
100000
483398076 227177515 705421329 ...

correct output
179178131

user output
(empty)