Submission #2433

#TimeUsernameProblemLanguageResultExecution timeMemory
2433pl0892029지우개 (GA4_eraser)C++98
100 / 100
25 ms2056 KiB
#include <cstdio> #include <algorithm> using namespace std; int dp[100001], val[100001], sum[100001]; const int mod = 1000000007; int main() { int n; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",val+i); for(int i=0;i<=n;i++) { sum[i] = 1; } sort(val+1,val+1+n); for(int p=0;p<3;p++) { int pivot = 0; for(int i=1;i<=n;i++) { while(pivot<i && val[pivot]<val[i]) pivot++; pivot--; dp[i] = (int)((long long)sum[pivot]*val[i]%mod); } sum[0] = 0; for(int i=1;i<=n;i++) sum[i] = (sum[i-1]+dp[i])%mod; } printf("%d",sum[n]); }
#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...