CSES - HIIT Open 2017 - Results
Submission details
Task:Algorithm
Sender:IOG
Submission time:2017-05-27 11:24:44 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.03 sdetails
#2ACCEPTED0.06 sdetails
#3ACCEPTED0.05 sdetails
#4ACCEPTED0.02 sdetails
#5ACCEPTED0.07 sdetails
#60.04 sdetails
#70.06 sdetails
#80.05 sdetails
#90.06 sdetails
#100.05 sdetails
#110.06 sdetails
#120.06 sdetails
#130.04 sdetails
#140.03 sdetails
#150.05 sdetails
#160.05 sdetails
#170.05 sdetails
#180.05 sdetails
#190.04 sdetails
#200.05 sdetails

Code

#include <bits/stdc++.h>

using namespace std;

int main(void)
{
 
 int n = 0;
 
 cin >> n;
 
 int sum = 0, res = 0;
 
 for (int i = 1; i <= n; ++i)
 {
     sum += i;
 }
 
 for (int i = n; i >= 1; i--)
 {
     res += sum;
     sum -= i;
 }
 
 
 cout << res << endl;
     
}

Test details

Test 1

Verdict: ACCEPTED

input
1

correct output
1

user output
1

Test 2

Verdict: ACCEPTED

input
2

correct output
4

user output
4

Test 3

Verdict: ACCEPTED

input
3

correct output
10

user output
10

Test 4

Verdict: ACCEPTED

input
4

correct output
20

user output
20

Test 5

Verdict: ACCEPTED

input
5

correct output
35

user output
35

Test 6

Verdict:

input
263528

correct output
3050239857553560

user output
1328574616

Test 7

Verdict:

input
630093

correct output
41693157083373415

user output
-1719345305

Test 8

Verdict:

input
108426

correct output
212452122723676

user output
1565427036

Test 9

Verdict:

input
407203

correct output
11253428501536410

user output
5693082

Test 10

Verdict:

input
798489

correct output
84851044799375085

user output
1612080877

Test 11

Verdict:

input
699773

correct output
57111314541226175

user output
534948031

Test 12

Verdict:

input
535193

correct output
25549503060424365

user output
1041938093

Test 13

Verdict:

input
951724

correct output
143675653860541900

user output
-147143220

Test 14

Verdict:

input
997759

correct output
165549173593263040

user output
-1528640576

Test 15

Verdict:

input
368832

correct output
8362537201182784

user output
-347330496

Test 16

Verdict:

input
497882

correct output
20569827174211084

user output
433020428

Test 17

Verdict:

input
235672

correct output
2181615649088424

user output
-104012888

Test 18

Verdict:

input
721959

correct output
62717416230802340

user output
1672139684

Test 19

Verdict:

input
328943

correct output
5932184601121240

user output
1541689816

Test 20

Verdict:

input
779320

correct output
78885627953685640

user output
-2012207992