Submission #9386

#TimeUsernameProblemLanguageResultExecution timeMemory
9386eternalklausUniting (kriii2_U)C++98
0 / 4
0 ms1868 KiB
#include <stdio.h> int arr[100000]; int sort[100000]; int main() { int n,i,j,index; int tmp; int sum=0; int nu=1; scanf("%d",&n); for(i=0;i<n;i++) { index=0; scanf("%d",&tmp); while(tmp>arr[index]&&index<i) index++; //index++자리에 인서트. for(j=i-1;j>=index;j--) arr[j+1]=arr[j]; arr[index]=tmp; } for(i=0;i<n-1;i++) { sum+=arr[i]*arr[i+1]; if(arr[i]!=arr[i+1]) nu=nu*2; arr[i+1]=arr[i]+arr[i+1]; } printf("%d\n",sum); printf("%d\n",nu); }
#Verdict Execution timeMemoryGrader output
Fetching results...