# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1086797 | Pacybwoah | Scales (IOI15_scales) | C++17 | 1 ms | 600 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "scales.h"
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void init(int T) {
/* ... */
}
void orderCoins() {
/* ... */
vector<int> vec;
int a = getMedian(1, 2, 3), b = getLightest(1, 2, 3);
vector<bool> vis(7);
vis[a] = 1;
vis[b] = 1;
vec.push_back(b);
vec.push_back(a);
for(int i = 1; i <= 3; i++) if(vis[i] == 0) vec.push_back(i);
a = getMedian(vec[0], vec[1], 4);
if(a == vec[0]) vec.insert(vec.begin(), 4);
else if(a == 4) vec.insert(vec.begin() + 1, 4);
else{
a = getMedian(vec[1], vec[2], 4);
if(a == 4) vec.insert(vec.begin() + 2, 4);
else vec.insert(vec.begin() + 3, 4);
}
a = getMedian(vec[0], vec[1], 5);
if(a == vec[0]) vec.insert(vec.begin(), 5);
else if(a == 5) vec.insert(vec.begin() + 1, 5);
else{
a = getMedian(vec[2], vec[3], 5);
if(a == vec[2]) vec.insert(vec.begin() + 2, 5);
else if(a == 5) vec.insert(vec.begin() + 3, 5);
else vec.insert(vec.begin() + 4, 5);
}
a = getMedian(vec[1], vec[2], 6);
if(a == 6){
vec.insert(vec.begin() + 2, 6);
}
else if(a == vec[1]){
a = getMedian(vec[0], vec[1], 6);
if(a == vec[0]) vec.insert(vec.begin(), 6);
else vec.insert(vec.begin() + 1, 6);
}
else{
a = getMedian(vec[3], vec[4], 6);
if(a == vec[3]) vec.insert(vec.begin() + 3, 6);
else if(a == 6) vec.insert(vec.begin() + 4, 6);
else vec.insert(vec.begin() + 5, 6);
}
int ans[6];
for(int i = 0; i < 6; i++) ans[i] = vec[i];
answer(ans);
}
// g++ -std=c++17 -o run -Wshadow -Wall -Wextra -fsanitize=undefined -fsanitize=address scales.cpp grader.cpp
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |