# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
163406 | 2019-11-13T06:45:02 Z | dantoh000 | Calvinball championship (CEOI15_teams) | C++14 | 227 ms | 652 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1000007; int main(){ int n; scanf("%d",&n); int a[n]; int k[n]; for (int i = 0; i < n; i++) { scanf("%d",&a[i]); if (i) k[i] = max(k[i-1],a[i]); else k[i] = a[i]; } ll ct[2][n+1]; ll ans = a[n-1]; for (int i = 0; i <= n; i++){ ct[0][i] = 1; } for (int j = 1; j < n-1; j++){ for (int i = 1; i < n; i++){ ct[j%2][i] = i*ct[1-j%2][i]+ct[1-j%2][i+1]; ct[j%2][i] %= mod; } //printf("before %d: %d unique numbers, adding %d %lld\n",a[j],k[n-j-2],a[n-j-1]-1,ct[j][k[n-j-2]]); ans += (a[n-j-1]-1)*ct[j%2][k[n-j-2]]; ans %= mod; } printf("%d",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 8 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 252 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 256 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 376 KB | Output is correct |
2 | Correct | 4 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 218 ms | 504 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 58 ms | 504 KB | Output is correct |
2 | Correct | 77 ms | 524 KB | Output is correct |
3 | Correct | 65 ms | 504 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 227 ms | 504 KB | Output is correct |
2 | Correct | 227 ms | 652 KB | Output is correct |
3 | Correct | 227 ms | 632 KB | Output is correct |