# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
685165 | APROHACK | Scales (IOI15_scales) | C++14 | 1 ms | 480 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 ll long long
using namespace std;
set<int>restantes;
vector<int>r;
int respuestas[4][6][6][6][6];
int mayor(int a, int b, int c){
if(respuestas[0][a][b][c][0] != -1 )return respuestas[0][a][b][c][0];
else return respuestas[0][a][b][c][0] = getHeaviest(a, b, c);
}
void init(int T) {
}
void reiniciar(){
for(int i = 1 ; i <= 6 ; i ++)restantes.insert(i);
memset(respuestas, -1 , sizeof respuestas);
}
void getRestantesEnORden(){
r.clear();
for(auto i : restantes){
r.pb(i);
}
}
void orderCoins() {
/* ... */
reiniciar();
int W[] = {1, 2, 3, 4, 5, 6};
getRestantesEnORden();
int a = mayor(r[0], r[1], r[2]);
int b = mayor(r[3], r[4], r[5]);
W[5] = mayor(a, b, (r[0] == a ? r[1] : r[0]));
restantes.erase(W[5]);
getRestantesEnORden();
a = mayor(r[0], r[1], r[2]);
W[4] = mayor(a, r[4], r[5]);
restantes.erase(W[4]);
getRestantesEnORden();
a = mayor(r[0], r[1], r[2]);
W[3] = mayor(a, r[4], (r[0] == a ? r[1] : r[0]));
restantes.erase(W[3]);
getRestantesEnORden();
W[2] = mayor(r[0], r[1], r[2]);
W[1] = getMedian(r[0], r[1], r[2]);
restantes.erase(W[2]);
restantes.erase(W[1]);
getRestantesEnORden();
W[0] = r[0];
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |