Submission #48986

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
489862018-05-21 06:08:54NamnamseoScales (IOI15_scales)C++17
100 / 100
639 ms1012 KiB
#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;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

In file included from grader.c:2:0:
graderlib.c: In function 'void answer(int*)':
graderlib.c:53:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (_ghksjhdfkae19ga_ > 1) 
     ^~
graderlib.c:56:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  for (i = 0; i < 6; i++) {
  ^~~
scales.cpp: In function 'void init(int)':
scales.cpp:10:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
scales.cpp: In function 'int maxdiff(std::vector<int>&, std::vector<int>&, std::vector<int>&)':
scales.cpp:36:18: warning: conversion to 'int' from 'std::vector<int>::size_type {aka long unsigned int}' may alter its value [-Wconversion]
     int a=av.size(), b=bv.size(), c=cv.size();
           ~~~~~~~^~
scales.cpp:36:31: warning: conversion to 'int' from 'std::vector<int>::size_type {aka long unsigned int}' may alter its value [-Wconversion]
     int a=av.size(), b=bv.size(), c=cv.size();
                        ~~~~~~~^~
scales.cpp:36:44: warning: conversion to 'int' from 'std::vector<int>::size_type {aka long unsigned int}' may alter its value [-Wconversion]
     int a=av.size(), b=bv.size(), c=cv.size();
                                     ~~~~~~~^~
scales.cpp: In function 'bool isValidState(std::vector<int>&, int)':
scales.cpp:114:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(states.size() > pow3[6-depth]) return false;
        ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
scales.cpp:119:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(a.size()>pow3[5-depth] || b.size()>pow3[5-depth] || c.size()>pow3[5-depth]){
            ~~~~~~~~^~~~~~~~~~~~~~
scales.cpp:119:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(a.size()>pow3[5-depth] || b.size()>pow3[5-depth] || c.size()>pow3[5-depth]){
                                      ~~~~~~~~^~~~~~~~~~~~~~
scales.cpp:119:72: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(a.size()>pow3[5-depth] || b.size()>pow3[5-depth] || c.size()>pow3[5-depth]){
                                                                ~~~~~~~~^~~~~~~~~~~~~~
scales.cpp: In function 'void orderCoins()':
scales.cpp:147:14: warning: unused variable 'isPoss' [-Wunused-variable]
         bool isPoss;
              ^~~~~~
scales.cpp:136:9: warning: variable 'first_state' set but not used [-Wunused-but-set-variable]
     int first_state = -1;
         ^~~~~~~~~~~
scales.cpp:171:16: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
         } else if(ret==f.c+1){
                ^~
#Verdict Execution timeMemoryGrader output
Fetching results...