# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
641630 |
2022-09-17T10:21:46 Z |
faruk |
Scales (IOI15_scales) |
C++17 |
|
1 ms |
304 KB |
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
int W[6];
void init(int T) {
}
void orderCoins() {
// first;
vector<int> f(3);
set<int> left;
left.insert(1);
left.insert(2);
left.insert(3);
f[0] = getLightest(1, 2, 3);
left.erase(f[0]);
f[1] = getMedian(1, 2, 3);
left.erase(f[1]);
for (int x : left)
f[2] = x;
left.clear();
// second
vector<int> l(3);
left.insert(4);
left.insert(5);
left.insert(6);
l[0] = getLightest(4, 5, 6);
left.erase(l[0]);
l[1] = getMedian(4, 5, 6);
left.erase(l[1]);
for (int x : left)
l[2] = x;
left.clear();
int pnt1 = 0, pnt2 = 0;
while (pnt1 < 3 && pnt2 < 3) {
if (pnt1 != 2) {
int mini = getLightest(f[pnt1], l[pnt2], f[pnt1 + 1]);
W[pnt1 + pnt2] = mini;
if (mini == f[pnt1])
pnt1++;
else
pnt2++;
}
else if (pnt2 != 2) {
int mini = getLightest(f[pnt1], l[pnt2], l[pnt2 + 1]);
W[pnt1 + pnt2] = mini;
if (mini == f[pnt1])
pnt1++;
else
pnt2++;
} else {
int maxi = getHeaviest(f[2], l[2], f[1]);
W[5] = maxi;
if (maxi == f[2])
W[4] = l[2];
else
W[4] = f[2];
pnt1++, pnt2++;
}
}
while (pnt1 < 3)
W[pnt1 + 3] = f[pnt1++];
while (pnt2 < 3)
W[pnt2 + 3] = l[pnt2], pnt2++;
answer(W);
}
/*
5 2 6 3 1 4
5 3 1 2 4 6
1 2 4 6 5 3
4 3 6 5 5 1
3 5 6 1 2 4
6 5 3 2 4 1
1 3 4 5 6 2
6 1 4 3 5 2
5 2 6 3 1 4 6
5 3 1 2 4 6 6
1 2 4 6 5 3 6
4 3 6 5 1 2 6
3 5 6 1 2 4 6
6 5 3 2 4 1 6
1 3 4 5 6 2 6
6 1 4 3 5 2 6
4 2 6 1 5 3 6
1 2 6 4 3 5 6
2 1 6 5 4 3 6
4 1 3 6 5 2 6
3 4 5 1 2 6 6
1 2 6 5 3 4 6
4 1 2 6 5 3 6
5 2 3 4 1 6 6
2 5 3 4 1 6 6
6 5 4 3 1 2 6
*/
Compilation message
scales.cpp: In function 'void init(int)':
scales.cpp:7:15: warning: unused parameter 'T' [-Wunused-parameter]
7 | void init(int T) {
| ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:69:29: warning: operation on 'pnt1' may be undefined [-Wsequence-point]
69 | W[pnt1 + 3] = f[pnt1++];
| ~~~~^~
# |
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 |
0 ms |
300 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
296 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
300 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 |
1 ms |
296 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 |
1 ms |
300 KB |
Output isn't correct |
22 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
23 |
Incorrect |
1 ms |
296 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 |
1 ms |
212 KB |
Output isn't correct |
28 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
29 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
30 |
Incorrect |
1 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 |
1 ms |
212 KB |
Output isn't correct |
34 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
35 |
Incorrect |
1 ms |
304 KB |
Output isn't correct |
36 |
Incorrect |
0 ms |
296 KB |
Output isn't correct |
37 |
Incorrect |
0 ms |
296 KB |
Output isn't correct |
38 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
39 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
40 |
Incorrect |
1 ms |
300 KB |
Output isn't correct |