# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
234718 | 2020-05-25T10:42:05 Z | Goolakh | Calvinball championship (CEOI15_teams) | C++17 | 380 ms | 640 KB |
// Do you knOW what it feels like? // To be TorTured by your own MinD? // I don't wanna feel the PAIN. // I BeG you to KILL me, pleASE... #include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O2") #pragma GCC optimize("unroll-loops") //#pragma GCC optimize("Os") #define F first #define S second #define pb push_back #define SZ(x) (ll)(x.size()) #define all(x) x.begin(),x.end() typedef int ll; typedef pair<ll,ll> pll; //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const ll maxn=1e4+10, lg=20, mod=1e9+7, inf=1e18; ll n; long long dp[2][maxn],ans=1; pll ad[maxn]; int main(){ ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); cin>>n; ll mx=0; for(int i=1;i<=n;i++){ ll x; cin>>x; ad[n-i]={mx,x-1}; //cout<<n-i<<' '<<mx<<' '<<x-1<<endl; mx=max(mx,x); } ans+=ad[0].S, ans%=mod; for(int j=0;j<=n;j++) dp[0][j]=1; for(int ii=1,i,gi;ii<=n;ii++){ i=ii%2; gi=1-i; for(int j=1;j<=n;j++) dp[i][j]=((dp[gi][j]*j%mod)+dp[gi][j-1])%mod; ans+=dp[i][ad[ii].F]*ad[ii].S%mod, ans%=mod; } cout<<ans; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | Output is correct |
2 | Incorrect | 5 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 354 ms | 640 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 103 ms | 528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 380 ms | 640 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |