Submission #68665

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
686652018-08-17 21:59:07FLDutchmanScales (IOI15_scales)C++14
100 / 100
23 ms892 KiB
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
typedef int INT;
#define FOR(i,l,r) for(int i = (l); i < (r); i++)
#define fst first
#define snd second
#define pb push_back
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;
vi op;
vvi args;
// this corresponds to the relative weight of the coins
vvi perms;
vi ans;
int pows[] = {1,3,9,27,81,243,729};
int heavy(int i, int A, int B, int C){
vi &p = perms[i];
if(p[A] > p[B] and p[A] > p[C]) return 0;
if(p[B] > p[A] and p[B] > p[C]) return 1;
if(p[C] > p[B] and p[C] > p[A]) return 2;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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 lambda function:
scales.cpp:42:52: warning: declaration of 'int i' shadows a parameter [-Wshadow]
     sort(arr.begin(), arr.end(), [&p] (int i, int j) {return p[i] < p[j];});
                                                    ^
scales.cpp:38:16: note: shadowed declaration is here
 int median(int i, int A, int B, int C){
                ^
scales.cpp: In function 'int build(vi&, int, int)':
scales.cpp:68:13: warning: unused variable 'i' [-Wunused-variable]
     for(int i : ps){ 
             ^
scales.cpp:89:56: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(max(division[0].size(), division[1].size()) <= pows[5-h] and division[2].size() <= pows[5-h]) {
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
scales.cpp:89:92: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(max(division[0].size(), division[1].size()) <= pows[5-h] and division[2].size() <= pows[5-h]) {
                                                                         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
scales.cpp:106:56: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(max(division[0].size(), division[1].size()) <= pows[5-h] and division[2].size() <= pows[5-h]) {
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
scales.cpp:106:92: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(max(division[0].size(), division[1].size()) <= pows[5-h] and division[2].size() <= pows[5-h]) {
                                                                         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
scales.cpp:123:56: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(max(division[0].size(), division[1].size()) <= pows[5-h] and division[2].size() <= pows[5-h]) {
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
scales.cpp:123:92: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(max(division[0].size(), division[1].size()) <= pows[5-h] and division[2].size() <= pows[5-h]) {
                                                                         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
scales.cpp:142:56: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(max(division[0].size(), division[1].size()) <= pows[5-h] and division[2].size() <= pows[5-h]) {
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
scales.cpp:142:92: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(max(division[0].size(), division[1].size()) <= pows[5-h] and division[2].size() <= pows[5-h]) {
                                                                         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
scales.cpp:80:21: warning: unused variable 'bestop' [-Wunused-variable]
     vi bestars; int bestop;
                     ^~~~~~
scales.cpp:81:12: warning: unused variable 'bestentropy' [-Wunused-variable]
     double bestentropy = 0;
            ^~~~~~~~~~~
scales.cpp: In function 'int query(int, vi)':
scales.cpp:164:9: warning: declaration of 'int i' shadows a parameter [-Wshadow]
     FOR(i, 0, 3) if(val == arg[i]) return i;
         ^
scales.cpp:7:28: note: in definition of macro 'FOR'
 #define FOR(i,l,r) for(int i = (l); i < (r); i++)
                            ^
scales.cpp:158:15: note: shadowed declaration is here
 int query(int i, vi arg){
               ^
scales.cpp: In function 'void init(INT)':
scales.cpp:173:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(INT T) {
               ^
scales.cpp: In function 'int heavy(int, int, int, int)':
scales.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
scales.cpp: In function 'int light(int, int, int, int)':
scales.cpp:36:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
scales.cpp: In function 'int median(int, int, int, int)':
scales.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
scales.cpp: In function 'int nextl(int, int, int, int, int)':
scales.cpp:58:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
scales.cpp: In function 'int query(int, vi)':
scales.cpp:165:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...