Submission #2177

#TimeUsernameProblemLanguageResultExecution timeMemory
2177cki86201지우개 (GA4_eraser)C++98
100 / 100
19 ms4792 KiB
#include<stdio.h> #include<algorithm> using namespace std; const int T=1e9+7; long long int Dp[100010][4]; long long int A[100010]; int X,N; int main() { scanf("%d",&N); int i,j; for(i=1;i<=N;i++){ int x;scanf("%d",&x); A[x]++; X=max(X,x); } for(i=1;i<=X;i++){A[i]*=i;A[i]%=T;} for(i=0;i<=X;i++)Dp[i][0]=1; for(j=1;j<=3;j++){ for(i=1;i<=X;i++){ Dp[i][j]=Dp[i-1][j]+Dp[i-1][j-1]*A[i]; Dp[i][j]%=T; } } printf("%d",Dp[X][3]); return 0; }
#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...