# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
47026 | 2018-04-26T12:54:49 Z | iletavcioski | Calvinball championship (CEOI15_teams) | C++17 | 395 ms | 1124 KB |
#include <iostream> #include <vector> using namespace std; typedef long long ll; const ll mod = 1000007; int main() { int n; cin>>n; vector<int> v; vector<int> maxi; vector<ll> dp; for(int i=0;i<n;i++) { int a; cin>>a; v.push_back(a); if(maxi.size()) { maxi.push_back(max(maxi[maxi.size()-1],a)); } else maxi.push_back(a); dp.push_back(1); } dp.push_back(1); ll brojac=1; for(int i=n-1;i>=0;i--) { int a; if(i==0) a=0; else a=maxi[i-1]; for(int j=1;j<v[i];j++) { brojac+=dp[max(a,j)]; brojac%=mod; } ll broj=dp[1]; for(int j=1;j<=i;j++) { dp[j]=1LL*j*dp[j]+dp[j+1]; dp[j]%=mod; } } cout<<brojac<<endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 408 KB | Output is correct |
4 | Correct | 2 ms | 408 KB | Output is correct |
5 | Correct | 2 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 544 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 544 KB | Output is correct |
2 | Correct | 2 ms | 544 KB | Output is correct |
3 | Correct | 2 ms | 544 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 544 KB | Output is correct |
2 | Correct | 2 ms | 544 KB | Output is correct |
3 | Correct | 2 ms | 544 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 544 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 544 KB | Output is correct |
2 | Correct | 2 ms | 628 KB | Output is correct |
3 | Correct | 2 ms | 628 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 636 KB | Output is correct |
2 | Correct | 2 ms | 636 KB | Output is correct |
3 | Correct | 3 ms | 636 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 636 KB | Output is correct |
2 | Correct | 3 ms | 636 KB | Output is correct |
3 | Correct | 6 ms | 636 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 373 ms | 892 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 892 KB | Output is correct |
2 | Correct | 44 ms | 892 KB | Output is correct |
3 | Correct | 99 ms | 892 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 115 ms | 1028 KB | Output is correct |
2 | Correct | 112 ms | 1028 KB | Output is correct |
3 | Correct | 395 ms | 1124 KB | Output is correct |