# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
441992 | 2021-07-06T16:20:27 Z | BeanZ | Calvinball championship (CEOI15_teams) | C++14 | 772 ms | 676 KB |
// I_Love_LPL 11m #include <bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' const int N = 3e5 + 5; long long mod = 1000007; const int lim = 4e5 + 5; const int lg = 22; const int base = 311; const long double eps = 1e-6; ll a[N], dp[N], mx[N], mem[N]; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); if (fopen("tests.inp", "r")){ freopen("test.inp", "r", stdin); freopen("test.out", "w", stdout); } ll n; cin >> n; for (int i = 1; i <= n; i++){ cin >> a[i]; mx[i] = max(mx[i - 1], a[i]); dp[i] = i; } ll ans = 0; ans = (a[n] - 1) % mod; for (int i = (n - 1); i >= 1; i--){ for (int j = 1; j <= n; j++){ mem[j] = dp[j]; } for (int j = 1; j <= n; j++){ dp[j] = ((j - 1) * mem[j] + mem[j + 1]) % mod; //cout << mem[j] << " "; } //cout << endl; ans = (ans + (a[i] - 1) * mem[mx[i - 1] + 1]) % mod; } cout << ans + 1; } /* Ans: Out: */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 332 KB | Output is correct |
2 | Correct | 0 ms | 332 KB | Output is correct |
3 | Correct | 0 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 0 ms | 332 KB | Output is correct |
6 | Correct | 0 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 0 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 0 ms | 320 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 332 KB | Output is correct |
2 | Correct | 2 ms | 332 KB | Output is correct |
3 | Correct | 2 ms | 352 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 332 KB | Output is correct |
2 | Correct | 8 ms | 460 KB | Output is correct |
3 | Correct | 8 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 748 ms | 624 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 190 ms | 480 KB | Output is correct |
2 | Correct | 190 ms | 492 KB | Output is correct |
3 | Correct | 188 ms | 504 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 762 ms | 624 KB | Output is correct |
2 | Correct | 770 ms | 672 KB | Output is correct |
3 | Correct | 772 ms | 676 KB | Output is correct |