CSES - Putka Open 2015 – 4/6 - Results
Submission details
Task:Pizzeria
Sender:Henrik Lievonen
Submission time:2015-10-10 11:03:11 +0300
Language:C++
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED16
#2ACCEPTED17
#3ACCEPTED67
Test results
testverdicttimegroup
#1ACCEPTED0.05 s1details
#2ACCEPTED0.05 s1details
#3ACCEPTED0.05 s1details
#4ACCEPTED0.05 s1details
#5ACCEPTED0.06 s1details
#6ACCEPTED0.05 s2details
#7ACCEPTED0.05 s2details
#8ACCEPTED0.06 s2details
#9ACCEPTED0.05 s2details
#10ACCEPTED0.05 s2details
#11ACCEPTED0.08 s3details
#12ACCEPTED0.09 s3details
#13ACCEPTED0.09 s3details
#14ACCEPTED0.10 s3details
#15ACCEPTED0.07 s3details

Code

#include <iostream>
#include <algorithm>
using namespace std;

typedef long long int ll;
const ll mod = 1000000007;

inline ll modadd(ll a, ll b) {
	return (a + b ) % mod;
}
inline ll modmul(ll a, ll b) {
	return (a*b) % mod;
}
inline ll modpow(ll b, ll e) {
	if (e == 0)
		return 1;
	if (e == 1)
		return b;
	if (e % 2 == 0) {
		ll p = modpow(b, e / 2);
		return modmul(p, p);
	}
	return modmul(modpow(b, e / 2), modpow(b, e / 2 + 1));
}
inline ll moddiv(ll a, ll b) {
	return modmul(a, modpow(b, mod - 2));
}

int main() {
	int n;
	cin >> n;

	ll sum = 0;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		sum = modadd(sum, a);
	}

	ll mul = modpow(2, n-1);;

	cout << modmul(sum, mul);
}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
10
14 15 98 62 44 94 18 81 23 20

correct output
240128

user output
240128

Test 2

Group: 1

Verdict: ACCEPTED

input
10
10 58 20 84 87 47 54 23 6 1

correct output
199680

user output
199680

Test 3

Group: 1

Verdict: ACCEPTED

input
10
80 83 53 72 20 34 86 59 3 60

correct output
281600

user output
281600

Test 4

Group: 1

Verdict: ACCEPTED

input
10
51 21 94 65 25 14 54 26 98 80

correct output
270336

user output
270336

Test 5

Group: 1

Verdict: ACCEPTED

input
10
98 74 9 82 76 44 95 19 21 74

correct output
303104

user output
303104

Test 6

Group: 2

Verdict: ACCEPTED

input
20
547665480 437998103 715147312 ...

correct output
900482986

user output
900482986

Test 7

Group: 2

Verdict: ACCEPTED

input
20
899274006 779214197 868921544 ...

correct output
597431505

user output
597431505

Test 8

Group: 2

Verdict: ACCEPTED

input
20
815886531 837353495 212009084 ...

correct output
500875272

user output
500875272

Test 9

Group: 2

Verdict: ACCEPTED

input
20
241554251 300825819 121861755 ...

correct output
727413214

user output
727413214

Test 10

Group: 2

Verdict: ACCEPTED

input
20
616368574 891725964 339440566 ...

correct output
983658830

user output
983658830

Test 11

Group: 3

Verdict: ACCEPTED

input
100000
139017989 246745424 98404713 1...

correct output
617854724

user output
617854724

Test 12

Group: 3

Verdict: ACCEPTED

input
100000
740140163 225697185 306382149 ...

correct output
600381749

user output
600381749

Test 13

Group: 3

Verdict: ACCEPTED

input
100000
434033625 139042292 589375131 ...

correct output
814308700

user output
814308700

Test 14

Group: 3

Verdict: ACCEPTED

input
100000
710545624 722749769 936750382 ...

correct output
818868442

user output
818868442

Test 15

Group: 3

Verdict: ACCEPTED

input
100000
952521692 471204215 999299313 ...

correct output
413038708

user output
413038708