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

Compiler report

input/code.cpp: In function 'std::vector<int> lol(std::vector<int>)':
input/code.cpp:13:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<a.size(); i++) {
               ~^~~~~~~~~
input/code.cpp:23:11: warning: variable 'u' set but not used [-Wunused-but-set-variable]
  for(auto u:b) {
           ^
input/code.cpp: In function 'std::vector<int> lol2(std::vector<int>, int)':
input/code.cpp:52:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<b.size(); i++) {
               ~^~~~~~~~~
input/code.cpp:56:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=i; j<b.size(); j++) {
                ~^~~~~~~~~
input/code.cpp:62:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if(pnt==a.size())
       ~~~^~~~~~~~~~
input/code.cpp:38:6: warning: unused variable 'ed' [-Wunused-variable]
  int ed =...

Code

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define M 1000000007
using namespace std;
vector<int> lol(vector<int> a) {
vector<tuple<int,int,int>> b;
vector<int> bb;
sort(a.begin(), a.end());
for(int i=0; i<a.size(); i++) {
for(int j=0; j<i; j++) {
b.push_back(make_tuple(a[i]+a[j], min(i, j), max(i, j)));
bb.push_back(a[i]+a[j]);
}
}
sort(b.begin(), b.end());
// for(auto u:a)
// cout << u << " ";
// cout << endl;
for(auto u:b) {
/* cout << get<0>(u) << " " << get<1>(u) << " " << get<2>(u) << " ";
if(a[get<1>(u)] == a[get<1>(b[0])])
cout << "x";
cout << "\n";*/
// cout << get<0>(u) << " ";
}
// cout << endl;
return bb;
}
vector<int> lol2(vector<int> b, int pienin) {
sort(b.begin(), b.end());
//int pienin = b[0]/2;
int ed = b[0];
vector<int> z(b.size());
vector<int> a;
/*for(auto u:b) {
if(u != ed) {
pienin = u-b[0];
break;
}
}*/
a.push_back(pienin);
a.push_back(b[0]-pienin);
// cout << a[0] << " ja " << a[1] << endl;
z[0] = 1;
int cnt = 1;
for(int i=0; i<b.size(); i++) {
if(z[i])
continue;
int pnt=0;
for(int j=i; j<b.size(); j++) {
if(z[j] || b[j] != ((b[i]-pienin)+a[pnt]))
continue;
pnt++;
z[j] = 1;
cnt++;
if(pnt==a.size())
break;
}
a.push_back(b[i]-pienin);
}
return a;
}
int main() {
cin.tie(0);
ios_base::sync_with_stdio(0);
int sd = time(NULL);
int n;
cin >> n;
vector<int> A;
int f;
for(int i=0; i<n; i++) {
cin >> f;
A.push_back(f);
}
for(int i=0; i<1000; i++) {
vector<int> ans = lol2(A, (A[0]+A[1]-A[i])/2);
if(ans.size() == A.size()) {
for(auto u:ans)
cout << u << " ";
return 0;
}
}
/*cout << "seed: " << sd << endl;
srand(sd);
vector<int> v;
for(int i=0; i<100; i++)
v.push_back(rand()%60+1);
sort(v.begin(), v.end());
multiset<int> st;
for(auto u:v)
st.insert(u);
//lol(v);
for(int i=0; i<1000; i++) {
if(lol(lol2(lol(v), (v[0]+v[1]-v[i])/2)) == lol(v)) {
cout << "OK"<<endl;
cout << (lol2(lol(v), (v[0]+v[1]-v[i])/2).size() == v.size());
} else {
cout << "EI OK"<<endl;
cout << (lol2(lol(v), (v[0]+v[1]-v[i])/2).size() == v.size());
}
}
// lol(lol2(lol(v), i));
//lol(v);
cout<<endl;
cout<<endl;
cout<<endl;
lol({1,2,3,4,5});
//lol(lol2({4,4,4,6,6,6}, 1));
*/
}

Test details

Test 1

Group: 1, 2, 3

Verdict:

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

correct output
1 1 1 1 1 

user output
(empty)

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:

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
(empty)

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: ACCEPTED

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
1 51 54 54 56 61 61 62 63 65 7...

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
1 24 29 30 31 35 38 39 40 44 4...

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
-7 16 17 21 24 24 27 28 29 31 ...

Test 11

Group: 3

Verdict:

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
(empty)

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
-7 10 11 12 12 13 13 14 14 14 ...
Truncated

Test 13

Group: 3

Verdict:

input
100
502824619 505239810 505668108 ...

correct output
1 502824618 505239809 50566810...

user output
249832515 252992104 255407295 ...
Truncated

Test 14

Group: 3

Verdict:

input
100
17871832 41618648 51611938 538...

correct output
3939271 13932561 37679377 4989...

user output
-2168709 20040541 43787357 537...
Truncated

Test 15

Group: 3

Verdict:

input
100
70588435 115481965 116040218 1...

correct output
5902586 64685849 109579379 110...

user output
3642165 66946270 111839800 112...
Truncated