Submission #1100847

# Submission time Handle Problem Language Result Execution time Memory
1100847 2024-10-14T19:49:13 Z vincentbucourt1 Calvinball championship (CEOI15_teams) C++14
0 / 100
2 ms 336 KB
#include <bits/stdc++.h>
using namespace std;
void fastIO() {
    ios_base::sync_with_stdio(false), cin.tie(0);
}
#define int long long

const int MOD = 1e9 + 7;
const int MAXN = 10001;

int N;
int vals[MAXN];

int ans = 0;

long long modular(long long base, long long exp, int mod) {
   long long res = 1;
   while (exp > 0) {
      if (exp % 2 == 1)
         res= (res * base) % mod;
      exp = exp >> 1;
      base = (base * base) % mod;
   }
   return res;
}

signed main() {
    fastIO();

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> vals[i];
    }
    reverse(vals, vals + N);

    for (int i = 0; i < N; i++) {
        ans += ((vals[i] - 1) * modular(N, i, MOD)) % MOD;
        ans %= MOD;
    }
    cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -