Submission #485551

#TimeUsernameProblemLanguageResultExecution timeMemory
485551sonho00지우개 (GA4_eraser)C++17
0 / 100
16 ms3788 KiB
#include<bits/stdc++.h> #define FOR(i,a,b) for(int i=a; i<=b; ++i) using namespace std; using ll=long long; using ld=long double; const ll MOD=1e9+7; const ll MAX=1e5; ll n; ll dp[MAX+5][4]; int main(){ cin.tie(0)->sync_with_stdio(0); cin>>n; for(int i=0; i<n; ++i){ ll a; cin>>a; dp[a][1]=(dp[a][1]+a)%MOD; } for(int i=1; i<=MAX; ++i){ for(int j=2; j<=3; ++j){ dp[i][j]=(dp[i-1][j]+dp[i-1][j-1]*dp[i][1])%MOD; } } cout<<dp[MAX][3]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...