#include "scales.h"
#include<bits/stdc++.h>
using namespace std;
void init(int T) {
/* ... */
}
int A[55];
void orderCoins() {
vector<int> x;
vector<int> v; for(int i = 1; i < 7; i++) v.push_back(i);
random_shuffle(v.begin(), v.end());
random_shuffle(v.begin(), v.end());
random_shuffle(v.begin(), v.end());
for(int i = 1; i < 7; i++) A[i] = v[i - 1];
int a = getLightest(A[1], A[2], A[3]), b = getHeaviest(A[1], A[2], A[3]);
x.push_back(a); x.push_back(A[1] + A[2] + A[3] - a - b); x.push_back(b);
// 4
a = getNextLightest(A[1], A[2], A[3], A[4]);
if(a != x[0]) {
vector<int> xn;
for(int i = 0; i < x.size(); i++) {
if(x[i] == a) xn.push_back(A[4]);
xn.push_back(x[i]);
}
x = xn;
} else {
if(getHeaviest(x[1], x[2], A[4]) == A[4]) x.push_back(A[4]);
else {
vector<int> xn;
xn.push_back(A[4]);
for(int i = 0; i < x.size(); i++) xn.push_back(x[i]);
x = xn;
}
}
// 5
a = getNextLightest(x[0], x[1], x[2], A[5]);
if(a != x[0]) {
vector<int> xn;
for(int i = 0; i < x.size(); i++) {
if(x[i] == a) xn.push_back(A[5]);
xn.push_back(x[i]);
}
x = xn;
} else {
if(getHeaviest(x[1], x[2], A[5]) == A[5]) {
if(getHeaviest(x[2], x[3], A[5]) == A[5]) {
x.push_back(A[5]);
} else {
vector<int> xn;
for(int i = 0; i < x.size(); i++) {
if(i == 3) xn.push_back(A[5]);
xn.push_back(x[i]);
}
x = xn;
}
} else {
vector<int> xn;
xn.push_back(A[5]);
for(int i = 0; i < x.size(); i++) xn.push_back(x[i]);
x = xn;
}
}
// 6
a = getNextLightest(x[1], x[2], x[3], A[6]);
if(a != x[1]) {
vector<int> xn;
for(int i = 0; i < x.size(); i++) {
if(x[i] == a) xn.push_back(A[6]);
xn.push_back(x[i]);
}
x = xn;
} else if(getHeaviest(x[2], x[3], A[6]) == A[6]) {
if(getHeaviest(x[3], x[4], A[6]) == A[6]) {
x.push_back(A[6]);
} else {
x.push_back(A[6]);
swap(x[5], x[4]);
}
} else {
vector<int> xn;
xn.push_back(A[6]);
for(int i = 0; i < x.size(); i++) xn.push_back(x[i]);
x = xn;
if(getLightest(x[0], x[1], x[2]) != A[6]) swap(x[0], x[1]);
}
// for(int i = 0; i < 6; i++) cout << x[i] << " ";
// cout << endl;
int W[] = {x[0], x[1], x[2], x[3], x[4], x[5]};
answer(W);
}
Compilation message
scales.cpp: In function 'void init(int)':
scales.cpp:4:15: warning: unused parameter 'T' [-Wunused-parameter]
4 | void init(int T) {
| ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:21:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
21 | for(int i = 0; i < x.size(); i++) {
| ~~^~~~~~~~~~
scales.cpp:31:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
31 | for(int i = 0; i < x.size(); i++) xn.push_back(x[i]);
| ~~^~~~~~~~~~
scales.cpp:40:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
40 | for(int i = 0; i < x.size(); i++) {
| ~~^~~~~~~~~~
scales.cpp:51:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
51 | for(int i = 0; i < x.size(); i++) {
| ~~^~~~~~~~~~
scales.cpp:60:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
60 | for(int i = 0; i < x.size(); i++) xn.push_back(x[i]);
| ~~^~~~~~~~~~
scales.cpp:68:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
68 | for(int i = 0; i < x.size(); i++) {
| ~~^~~~~~~~~~
scales.cpp:83:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
83 | for(int i = 0; i < x.size(); i++) xn.push_back(x[i]);
| ~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
2 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
3 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
4 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
5 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
6 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
7 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
8 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
9 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
10 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
11 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
12 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
13 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
14 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
15 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
16 |
Partially correct |
0 ms |
296 KB |
Output is partially correct |
17 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
18 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
19 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
20 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
21 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
22 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
23 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
24 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
25 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
26 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
27 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
28 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
29 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
30 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
31 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
32 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
33 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
34 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
35 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
36 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
37 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
38 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
39 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
40 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |