# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
140097 | SirCeness | Scales (IOI15_scales) | C++14 | 3 ms | 504 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 <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define inside sl<=l&&r<=sr
#define outside r<sl||sr<l
#define orta ((l+r)>>1)
#define INF 1000000009
#define mod 1000000007
#define ppair(x); cerr << "(" << x.first << ", " << x.second << ")\n";
#define bas(x) #x << ": " << x << " "
#define prarr(x, n); cerr << #x << ": "; for(int qsd = 0; qsd < n; qsd++) cerr << x[qsd] << " "; cerr << "\n";
#define prarrv(x); cerr << #x << ": "; for(int qsd = 0; qsd < (int)x.size(); qsd++) cerr << x[qsd] << " "; cerr << "\n";
using namespace std;
typedef long long ll;
void init(int T) {
/* ... */
}
void sil(vector<int>& arr, int val){
for (int i = 0; i < arr.size()-1; i++){
if (arr[i] == val){
swap(arr[i], arr[arr.size()-1]);
break;
}
}
arr.pop_back();
}
void orderCoins() {
/* ... */
int W[] = {1, 2, 3, 4, 5, 6};
vector<int> nums;
for (int i = 0; i < 6; i++) nums.pb(i+1);
for (int i = 0; i < 3; i++){
int l = getLightest(nums[0], nums[1], nums[2]);
if (nums.size() > 4) l = getLightest(l, nums[3], nums[4]);
else if (nums.size() > 3){
int fake = nums[0];
if (fake == l) fake = nums[1];
l = getLightest(l, fake, nums[3]);
}
if (nums.size() > 5) {
int fake = nums[0];
if (fake == l) fake = nums[1];
l = getLightest(l, fake, nums[5]);
}
sil(nums, l);
W[i] = l;
}
W[3] = getLightest(nums[0], nums[1], nums[2]);
W[4] = getMedian(nums[0], nums[1], nums[2]);
sil(nums, W[3]);
sil(nums, W[4]);
W[5] = nums[0];
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |