# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
802691 |
2023-08-02T13:26:46 Z |
Liudas |
Scales (IOI15_scales) |
C++17 |
|
1 ms |
256 KB |
#include <bits/stdc++.h>
#include "scales.h"
using namespace std;
void orderCoins(){
int arr[6];
vector<int> b = {1,2,3,4,5,6};
int ans = getHeaviest(1,2,3);
int ans2 = getHeaviest(4, 5, 6);
int ans3 = getHeaviest(ans, ans2, (ans == 3? 2: 3));
arr[5] = ans3;
b.erase(find(b.begin(), b.end(), ans3));
if(ans == ans3){
b.erase(find(b.begin(), b.end(), ans2));
ans3 = getHeaviest(b[0], b[1], ans2);
b.push_back(ans2);
}
else{
b.erase(find(b.begin(), b.end(), ans));
ans3 = getHeaviest(b[2], b[3], ans);
b.push_back(ans);
}
b.erase(find(b.begin(), b.end(), ans3));
arr[4] = ans3;
int c1 = b[0], c2 = b[1], c3 = b[2], c4;
ans = getLightest(b[0],b[1],b[2]);
b.erase(find(b.begin(), b.end(), ans));
ans2 = getHeaviest(b[0], b[1], b[2]);
b.push_back(ans);
b.erase(find(b.begin(), b.end(), ans2));
arr[3] = ans2;
ans3 = getMedian(b[0], b[1], b[2]);
if(ans == c1){
b.erase(find(b.begin(), b.end(), c1));
if(ans2 == c2){
b.erase(find(b.begin(), b.end(), c3));
c4 = c3;
}
if(ans2 == c3){
b.erase(find(b.begin(), b.end(), c2));
c4 = c2;
}
if(ans3 == ans){
arr[0] = b[0];
arr[1] = ans;
arr[2] = c4;
}
else if(ans3 == c4){
arr[0] = ans;
arr[1] = c4;
arr[2] = b[0];
}
else{
arr[0] = ans;
arr[1] = b[0];
arr[2] = c4;
}
}
if(ans == c2){
b.erase(find(b.begin(), b.end(), c2));
if(ans2 == c1){
b.erase(find(b.begin(), b.end(), c3));
c4 = c3;
}
if(ans2 == c3){
b.erase(find(b.begin(), b.end(), c1));
c4 = c1;
}
if(ans3 == ans){
arr[0] = b[0];
arr[1] = ans;
arr[2] = c4;
}
else if(ans3 == c4){
arr[0] = ans;
arr[1] = c4;
arr[2] = b[0];
}
else{
arr[0] = ans;
arr[1] = b[0];
arr[2] = c4;
}
}
if(ans == c3){
b.erase(find(b.begin(), b.end(), c3));
if(ans2 == c2){
b.erase(find(b.begin(), b.end(), c1));
c4 = c1;
}
if(ans2 == c1){
b.erase(find(b.begin(), b.end(), c2));
c4 = c2;
}
if(ans3 == ans){
arr[0] = b[0];
arr[1] = ans;
arr[2] = c4;
}
else if(ans3 == c4){
arr[0] = ans;
arr[1] = c4;
arr[2] = b[0];
}
else{
arr[0] = ans;
arr[1] = b[0];
arr[2] = c4;
}
}
answer(arr);
}
void init(int T){
}
Compilation message
scales.cpp: In function 'void init(int)':
scales.cpp:113:15: warning: unused parameter 'T' [-Wunused-parameter]
113 | void init(int T){
| ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:74:14: warning: 'c4' may be used uninitialized in this function [-Wmaybe-uninitialized]
74 | else if(ans3 == c4){
| ^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
14 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
16 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
17 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
18 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
19 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
20 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
21 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
22 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
23 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
24 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
25 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
26 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
27 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
28 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
29 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
30 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
31 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
33 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
34 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
35 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
36 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
37 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
38 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
39 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
40 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |