# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
727410 | Vu_CG_Coder | Scales (IOI15_scales) | C++14 | 1 ms | 300 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.
/* [Author : Hoang Duy Vu] - THPT Chuyen Nguyen Du */
//#pragma GCC optimize(" unroll-loops")
//#pragma gcc optimize("Ofast")
//#pragma GCC optimization("Ofast")
//#pragma optimize(Ofast)
#include "scales.h"
#include <bits/stdc++.h>
#define All(x) (x).begin(),(x).end()
#define ll long long
#define C make_pair
#define fi first
#define se second
#define two second.first
#define thr second.second
#define TASK "txt"
using namespace std;
template<typename T> bool maximize(T &res, const T &val) {
if (res < val) { res = val; return true; } return false; }
template<typename T> bool minimize(T &res, const T &val) {
if (res > val) { res = val; return true; } return false; }
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
const int LOG = 20;
const int INF = 1e9 + 7;
const ll LNF = 1e18 + 7;
const int mod = 1e9 + 7;
const int N = 10;
int A[N];
int B[N];
int f[N] = {0};
int cnt = 0;
int val[N];
// int getLightest(int a , int b , int c)
// {
// for (int i = 0 ; i < 5 ; i++)
// if (val[i] == a || val[i] == b || val[i] == c) return val[i];
// }
// int getMedian(int a , int b , int c)
// {
// int d = 0;
// for (int i = 0 ; i < 5 ; i++)
// if (val[i] == a || val[i] == b || val[i] == c)
// {
// d++;
// if (d == 2) return val[i];
// }
// }
void init(int T) {
}
void orderCoins() {
int W[] = {1,2,3,4,5,6};
memset(f,0,sizeof(f));
cnt = 0;
A[1] = getLightest(1, 2, 3);
A[2] = getMedian(1, 2, 3);
f[A[1]]++;
f[A[2]]++;
B[1] = getLightest(4, 5, 6);
B[2] = getMedian(4, 5, 6);
f[B[1]]++;
f[B[2]]++;
for (int i = 1 ; i <= 3 ; i++) if (!f[i]) A[3] = i;
for (int i = 4 ; i <= 6 ; i++) if (!f[i]) B[3] = i;
int l = 1 , r = 1;
int x = getLightest(A[1],B[1],B[2]);
if (x == A[1])
{
l++;
W[cnt++] = A[1];
}
else
{
r++;
W[cnt++] = B[1];
}
while (cnt < 6)
{
if (l > 3)
{
W[cnt++] = B[r];
r++;
}
else
if (r > 3)
{
W[cnt++] = A[l];
l++;
}
if (r > 3 || l > 3) continue;
int y = getMedian(W[0],A[l],B[r]);
if (y == A[l])
{
W[cnt++] = A[l];
l++;
}
else
{
W[cnt++] = B[r];
r++;
}
}
// for (int i = 0 ; i < 6 ; i++) cout << W[i] << " ";
// cout << "\n";
answer(W);
}
// int main()
// {
// ios_base::sync_with_stdio(0);
// cin.tie(NULL); cout.tie(NULL);
// if(fopen(TASK".inp", "r")){
// freopen(TASK".inp","r",stdin);
// freopen(TASK".out","w",stdout);
// }
// int t;
// cin >> t;
// while (t--)
// {
// for (int i = 0 ; i < 6 ; i++) cin >> val[i];
// orderCoins();
// }
// return 0;
// }
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |