# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
424513 | cpp219 | Calvinball championship (CEOI15_teams) | C++14 | 46 ms | 65540 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimization "O2"
#pragma GCC optimization "unroll-loop"
#pragma GCC target ("avx2")
#include <bits/stdc++.h>
#define ll int
#define ld long double
#define fs first
#define sc second
using namespace std;
const ll N = 1e4 + 9;
const ll mod = 1e6 + 7;
typedef pair<ll,ll> LL;
ll n,x,dp[N][N],ans = 1;
ll f(ll pos,ll lim){
if (pos == n + 1) return 1;
if (pos == n) return lim;
if (dp[pos][lim] != -1) return dp[pos][lim];
ll ans = 0;
ans = ((lim - 1)*f(pos + 1,lim)) % mod + f(pos + 1,lim + 1);
ans %= mod;
return dp[pos][lim] = ans;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
#define task "test"
if (fopen(task".inp", "r")){
freopen(task".inp", "r", stdin);
freopen(task".out", "w", stdout);
}
cin>>n; memset(dp,-1,sizeof(dp));
ll mx = 0; //cout<<f(3,2); return 0;
for (ll i = 1;i <= n;i++){
cin>>x;
ans += (x - 1)*f(i + 1,mx + 1); ans %= mod;
//cout<<(x - 1)*f(i + 1,mx + 1)<<"x\n";
mx = max(mx,x);
}
cout<<ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |