Submission #1121840

#TimeUsernameProblemLanguageResultExecution timeMemory
1121840vjudge1Calvinball championship (CEOI15_teams)C++17
10 / 100
2 ms336 KiB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define FORI(i, n) for(ll i = 0; i < n; i++)
#define FOR(i, n) for(ll i = 1; i <= n; i++)
typedef vector < ll > vl; 
typedef set < ll > setl;
#define ff first
#define ss second    
#define all(v) v.begin(), v.end() 
#define pll pair<ll, ll> 
#define db double
#define nll cout << "\n"
#define nl "\n"
#define sync ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

const ll mod =  1e9 + 7;
const int MAX = 300000 + 5;
const int imax = 2147483647;
ll n, m, k, res, rnk[MAX];
ll a[MAX];
void solve(){
    cin >> n;
    ll res = 0;
    for(ll i = n; i >= 1; i--)cin >> a[i], res += (i * a[i]);
    cout << res  - (n * (n + 1) / 2) + 1;      
}
signed main(){  
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    sync;
    ll t = 1;
    // cin >> t;
    FOR(i, t){
        // cout << "Case #" << i << ": ";
        solve();
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...