CSES - Putka Open 2020 – 2/5 - Results
Submission details
Task:Summat
Sender:Mahtimursu
Submission time:2020-09-26 16:15:17 +0300
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1, 2, 3details
#20.01 s1, 2, 3details
#3ACCEPTED0.01 s1, 2, 3details
#40.01 s1, 2, 3details
#50.01 s1, 2, 3details
#6ACCEPTED0.01 s2, 3details
#70.01 s2, 3details
#80.01 s2, 3details
#90.01 s2, 3details
#100.01 s2, 3details
#11ACCEPTED0.01 s3details
#120.01 s3details
#130.01 s3details
#140.01 s3details
#150.01 s3details

Code

#include <bits/stdc++.h>
typedef long long ll;
#define M 1000000007
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
int b = n * (n - 1) / 2;
vector<int> in(b);
for (int i = 0; i < b; ++i) {
cin >> in[i];
}
// Lasketaan erot toiseen lukuun
vector<int> diff(n);
//diff[1] = v[n - 1] - v[1];
diff[0] = in[1] - in[n - 1];
for (int i = 1; i < n; ++i) {
diff[i] = in[i - 1] - in[0];
}
// Yll� oleva testattu
for (int sval = 1; sval <= 200; sval++) {
// Muodostetaan lista toisen arvon pohjalta
vector<int> ans;
bool ok = true;
for (int val : diff) {
if (sval + val <= 0) {
//cout << "broke1" << endl;
ok = false;
break;
}
else {
ans.push_back(sval + val);
}
}
if (!ok) continue;
vector<int> cons;
// Rakennetaan uusi input, ja verrataan siihen
for (int i = 0; i < n - 1; ++i) {
for (int j = i + 1; j < n; ++j) {
cons.push_back(ans[i] + ans[j]);
}
}
for (int i = 0; i < b; ++i) {
if (cons[i] != in[i]) {
//cout << "broke2" << endl;
ok = false;
break;
}
}
if (ok) {
for (int val : ans)
cout << val << " ";
cout << endl;
return 0;
}
}
/*int k = 50;
while (true) {
vector<int> ans(k);
for (int i = 0; i < k; ++i) {
ans[i] = rand() % 100 + 1;
}
vector<int> input;
for (int i = 0; i < k - 1; ++i) {
for (int j = i + 1; j < k; ++j) {
input.push_back(ans[i] + ans[j]);
}
}
vector<int> d(k);
//diff[1] = v[n - 1] - v[1];
d[0] = input[1] - input[k - 1];
for (int i = 1; i < k; ++i) {
d[i] = input[i - 1] - input[0];
}
bool ok = true;
for (int i = 0; i < k; ++i) {
if (d[i] + ans[1] != ans[i]) {
ok = false;
break;
}
}
if (!ok) {
cout << "WRONG DIFF" << endl;
for (int val : input) {
cout << val << " ";
}
cout << endl;
cout << "ANS: ";
for (int val : ans) {
cout << val << " ";
}
cout << endl << "DIFF: ";
for (int val : d)
cout << val << " ";
break;
}
else {
cout << "OK" << endl;
}
}*/
return 0;
}

Test details

Test 1

Group: 1, 2, 3

Verdict: ACCEPTED

input
5
2 2 2 2 2 2 2 2 2 2

correct output
1 1 1 1 1 

user output
1 1 1 1 1 

Test 2

Group: 1, 2, 3

Verdict:

input
5
3 4 5 5 6 6 7 7 8 9

correct output
1 2 3 4 5 

user output
(empty)

Test 3

Group: 1, 2, 3

Verdict: ACCEPTED

input
5
5 6 6 6 9 9 9 10 10 10

correct output
1 4 5 5 5 

user output
1 4 5 5 5 

Test 4

Group: 1, 2, 3

Verdict:

input
5
2 3 3 6 6 6 6 7 7 10

correct output
1 1 2 5 5 

user output
(empty)

Test 5

Group: 1, 2, 3

Verdict:

input
5
4 5 5 5 5 6 6 6 7 7

correct output
2 2 3 3 4 

user output
(empty)

Test 6

Group: 2, 3

Verdict: ACCEPTED

input
20
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

correct output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

user output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

Test 7

Group: 2, 3

Verdict:

input
20
3 4 5 5 6 6 7 7 7 8 8 8 9 9 9 ...

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 8

Group: 2, 3

Verdict:

input
20
52 55 55 57 62 62 63 64 66 71 ...

correct output
1 51 54 54 56 61 61 62 63 65 7...

user output
(empty)

Test 9

Group: 2, 3

Verdict:

input
20
25 30 31 32 36 39 40 41 45 45 ...

correct output
8 17 22 23 24 28 43 50 53 55 6...

user output
(empty)

Test 10

Group: 2, 3

Verdict:

input
20
9 10 14 17 17 20 21 22 24 25 2...

correct output
1 8 9 13 16 19 30 32 38 40 43 ...

user output
(empty)

Test 11

Group: 3

Verdict: ACCEPTED

input
100
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

correct output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

user output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
Truncated

Test 12

Group: 3

Verdict:

input
100
3 4 5 5 6 6 7 7 7 8 8 8 9 9 9 ...

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 13

Group: 3

Verdict:

input
100
502824619 505239810 505668108 ...

correct output
1 502824618 505239809 50566810...

user output
(empty)

Test 14

Group: 3

Verdict:

input
100
17871832 41618648 51611938 538...

correct output
3939271 13932561 37679377 4989...

user output
(empty)

Test 15

Group: 3

Verdict:

input
100
70588435 115481965 116040218 1...

correct output
5902586 64685849 109579379 110...

user output
(empty)