Submission #617456

# Submission time Handle Problem Language Result Execution time Memory
617456 2022-08-01T11:30:01 Z ollel Calvinball championship (CEOI15_teams) C++14
0 / 100
48 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;

#define rep(i,a,b) for(int i = a; i < b; i++)

const ll MOD = 1000007;
const int MAXN = 10000;

int main() {
  int n; cin >> n;
  vector<vector<ll>> dp(MAXN + 5, vector<ll>(MAXN + 5, 1));
  rep(i,0,MAXN+1) dp[1][i] = i+1;
  rep(x,2,MAXN+1) {
    rep(y,0,MAXN+1) {
      dp[x][y] = (y * dp[x - 1][y] + dp[x - 1][y + 1]) % MOD;
    }
  }

  vi state(n);
  rep(i,0,n) cin >> state[i];

  ll ans = 1;
  int MAX = 1, LEFT = n;

  rep(i,0,n) {
    ans = (ans + (state[i] - 1) * dp[LEFT - 1][MAX]) % MOD;
    MAX = max(MAX, state[i]);
    LEFT--;
  }
  cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Runtime error 48 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 29 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 29 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 34 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 33 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 29 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 30 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 32 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 40 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 27 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -