Submission #2338

#TimeUsernameProblemLanguageResultExecution timeMemory
2338crazysoldier지우개 (GA4_eraser)C++98
0 / 100
13 ms2940 KiB
#include <iostream> #include <stdio.h> using namespace std; long long a[100009],b[100009]; int main() { long long n,input,MaX,i,SizE=0; long long Sum=0,Mid=0,MiD=0; scanf("%lld",&n); scanf("%lld",&input); MaX=input; a[input]++; for(i=2;i<=n;i++) { scanf("%d",&input); a[input]++; if(MaX<input) MaX = input; } for(i=1;i<=MaX;i++)if(i*a[i]) { SizE++; b[SizE]=i*a[i]; } for(i=1;i<=SizE;i++) Mid += b[i]; Sum += Mid*Mid*Mid; for(i=1;i<=SizE;i++) Sum += 2*b[i]*b[i]*b[i]; Mid = 0; for(i=1;i<=SizE;i++){Mid+=b[i]*b[i]; MiD+=b[i];} Sum -= 3*Mid*MiD; printf("%lld",Sum/6); 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...