# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
48986 | Namnamseo | Scales (IOI15_scales) | C++17 | 639 ms | 1012 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 <algorithm>
#include <vector>
#include <functional>
using namespace std;
int lst[720][6];
void init(int T) {
int cur[6];
for(int i=0; i<6; ++i) cur[i]=i+1;
int ind=0;
do {
for(int i=0; i<6; ++i) lst[ind][i]=cur[i];
++ind;
} while(next_permutation(cur, cur+6));
}
inline int f1(int a,int b,int c){ return max(a, max(b, c)); }
inline int f2(int a,int b,int c){ return min(a, min(b, c)); }
inline int f3(int a,int b,int c){ return a+b+c-f1(a,b,c)-f2(a,b,c); }
inline int f4(int a,int b,int c,int d){
int t;
if((t=f1(a,b,c))<d) return f2(a,b,c);
else {
int u=f2(a,b,c);
int v=a+b+c-t-u;
if(v<d) return t;
if(u<d) return v;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |