답안 #9782

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
9782 2014-09-28T08:55:15 Z kkjjkk Uniting (kriii2_U) C++
1 / 4
16 ms 4800 KB
#include <algorithm>
#include <iostream>
#include <cstdio>
using namespace std;
long long h[100005];
long long f[100005], m = 1000000007, nn[100005], tw[100005];

int main()
{
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i++) scanf("%lld", &h[i]);
    f[1] = 1;
    for(int i = 2; i < 100005; i++) { f[i] = f[i - 1] * i; f[i] %= m; }
    tw[1] = 2;
    for(int i = 2; i < 100005; i++) { tw[i] = tw[i - 1] * 2; tw[i] %= m; }
    if(n == 1) { printf("0\n"); printf("1"); }
    else if(n == 2) { printf("%lld\n", h[0] * h[1]); printf("2"); }
    else {
         //sort(h, h + n);
         
         long long a = h[0] + h[1];
         long long b = h[0] * h[1];
         long long c, d;//, m = 1000000007;
         for(int i = 2; i < n; i++) {
              /*c = a + h[i];
              d = ((a % m) * h[i]) % m; //d %= ;
              a = c;
              b = ((b % m) + (d % m)) % m; //b %= 1000000007;*/
              c = a * h[i]; //c %= m;
              a += h[i]; b += c; //b %= m;
         }
         printf("%lld\n", b);
         printf("%lld", (f[n] * tw[n - 2]) % m);
         
    }
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 4 ms 4800 KB Output is partially correct
2 Partially correct 4 ms 4800 KB Output is partially correct
3 Partially correct 4 ms 4800 KB Output is partially correct
4 Partially correct 4 ms 4800 KB Output is partially correct
5 Partially correct 4 ms 4800 KB Output is partially correct
6 Partially correct 0 ms 4800 KB Output is partially correct
7 Partially correct 4 ms 4800 KB Output is partially correct
8 Partially correct 4 ms 4800 KB Output is partially correct
9 Partially correct 4 ms 4800 KB Output is partially correct
10 Partially correct 4 ms 4800 KB Output is partially correct
11 Partially correct 4 ms 4800 KB Output is partially correct
12 Partially correct 4 ms 4800 KB Output is partially correct
13 Partially correct 0 ms 4800 KB Output is partially correct
14 Partially correct 0 ms 4800 KB Output is partially correct
15 Partially correct 4 ms 4800 KB Output is partially correct
16 Partially correct 0 ms 4800 KB Output is partially correct
17 Partially correct 4 ms 4800 KB Output is partially correct
18 Partially correct 4 ms 4800 KB Output is partially correct
19 Partially correct 4 ms 4800 KB Output is partially correct
20 Partially correct 4 ms 4800 KB Output is partially correct
21 Partially correct 4 ms 4800 KB Output is partially correct
22 Partially correct 4 ms 4800 KB Output is partially correct
23 Partially correct 4 ms 4800 KB Output is partially correct
24 Partially correct 8 ms 4800 KB Output is partially correct
25 Partially correct 8 ms 4800 KB Output is partially correct
26 Partially correct 8 ms 4800 KB Output is partially correct
27 Partially correct 8 ms 4800 KB Output is partially correct
28 Partially correct 8 ms 4800 KB Output is partially correct
29 Partially correct 4 ms 4800 KB Output is partially correct
30 Partially correct 8 ms 4800 KB Output is partially correct
31 Partially correct 8 ms 4800 KB Output is partially correct
32 Partially correct 8 ms 4800 KB Output is partially correct
33 Partially correct 8 ms 4800 KB Output is partially correct
34 Partially correct 4 ms 4800 KB Output is partially correct
35 Partially correct 4 ms 4800 KB Output is partially correct
36 Partially correct 12 ms 4800 KB Output is partially correct
37 Partially correct 8 ms 4800 KB Output is partially correct
38 Partially correct 12 ms 4800 KB Output is partially correct
39 Partially correct 12 ms 4800 KB Output is partially correct
40 Partially correct 8 ms 4800 KB Output is partially correct
41 Partially correct 8 ms 4800 KB Output is partially correct
42 Partially correct 8 ms 4800 KB Output is partially correct
43 Partially correct 12 ms 4800 KB Output is partially correct
44 Partially correct 8 ms 4800 KB Output is partially correct
45 Partially correct 12 ms 4800 KB Output is partially correct
46 Partially correct 16 ms 4800 KB Output is partially correct
47 Partially correct 12 ms 4800 KB Output is partially correct
48 Partially correct 4 ms 4800 KB Output is partially correct
49 Partially correct 12 ms 4800 KB Output is partially correct
50 Partially correct 12 ms 4800 KB Output is partially correct