# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
140101 | SirCeness | Scales (IOI15_scales) | C++14 | 2 ms | 380 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 swap(int a, int b, vector<int>& ar){
if (a == b) return;
int s1, s2;
for (int i = 0; i < ar.size(); i++){
if (ar[i] == a) s1 = i;
if (ar[i] == b) s2 = i;
}
swap(ar[s1], ar[s2]);
}
void orderCoins() {
/* ... */
int W[] = {1, 2, 3, 4, 5, 6};
vector<int> arr;
for (int i = 0; i < 6; i++) arr.pb(i+1);
int l1 = getLightest(arr[0], arr[1], arr[2]);
swap(l1, arr[0], arr);
//prarrv(arr);
int l2 = getLightest(arr[3], arr[4], arr[5]);
swap(l2, arr[3], arr);
swap(arr[1], arr[3], arr);
//prarrv(arr);
int minn = getLightest(arr[0], arr[1], arr[2]);
if (minn == arr[1]){
swap(arr[0], arr[1], arr);
swap(arr[2], arr[4], arr);
swap(arr[3], arr[5], arr);
}
//prarrv(arr);
int minn2 = getLightest(arr[1], arr[2], arr[3]);
swap(minn2, arr[1], arr);
//prarrv(arr);
int olmaz = getHeaviest(arr[2], arr[3], arr[4]);
swap(olmaz, arr[5], arr);
int sonmin = getLightest(arr[2], arr[3], arr[4]);
swap(sonmin, arr[2], arr);
//prarrv(arr);
int minnn = getLightest(arr[3], arr[4], arr[5]);
swap(arr[3], minnn, arr);
int maxxx = getHeaviest(arr[3], arr[4], arr[5]);
swap(arr[5], maxxx, arr);
for (int i = 0; i < 6; i++) W[i] = arr[i];
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |