제출 #130567

#제출 시각아이디문제언어결과실행 시간메모리
130567keko37저울 (IOI15_scales)C++14
0 / 100
2 ms504 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; int p[750][7], pos[750][7]; void indeksiraj () { int c[6] = {0, 1, 2, 3, 4, 5}; int cnt = 0; do { for (int i=0; i<6; i++) { p[cnt][i] = c[i]; pos[cnt][p[cnt][i]] = i; } cnt++; } while (next_permutation(c, c + 6)); } vector <int> va, vb, vc; bool partMin (const vector <int> &v, int a, int b, int c, int siz) { va.clear(); vb.clear(); vc.clear(); int lim = v.size(), x, y, z; for (int i=0; i<lim; i++) { x = pos[v[i]][a]; y = pos[v[i]][b]; z = pos[v[i]][c]; if (x < y && x < z) va.push_back(v[i]); if (y < x && y < z) vb.push_back(v[i]); if (z < x && z < y) vc.push_back(v[i]); if (va.size() > siz || vb.size() > siz || vc.size() > siz) return 0; } return 1; } bool partMax (const vector <int> &v, int a, int b, int c, int siz) { va.clear(); vb.clear(); vc.clear(); int lim = v.size(), x, y, z; for (int i=0; i<lim; i++) { x = pos[v[i]][a]; y = pos[v[i]][b]; z = pos[v[i]][c]; if (x > y && x > z) va.push_back(v[i]); if (y > x && y > z) vb.push_back(v[i]); if (z > x && z > y) vc.push_back(v[i]); if (va.size() > siz || vb.size() > siz || vc.size() > siz) return 0; } return 1; } bool partMed (const vector <int> &v, int a, int b, int c, int siz) { va.clear(); vb.clear(); vc.clear(); int lim = v.size(), x, y, z; for (int i=0; i<lim; i++) { x = pos[v[i]][a]; y = pos[v[i]][b]; z = pos[v[i]][c]; if (y < x && x < z || z < x && x < y) va.push_back(v[i]); if (x < y && y < z || z < y && y < x) vb.push_back(v[i]); if (x < z && z < y || y < z && z < x) vc.push_back(v[i]); if (va.size() > siz || vb.size() > siz || vc.size() > siz) return 0; } return 1; } bool partMagic (const vector <int> &v, int a, int b, int c, int d, int siz) { va.clear(); vb.clear(); vc.clear(); int lim = v.size(), x, y, z, w; for (int i=0; i<lim; i++) { x = pos[v[i]][a]; y = pos[v[i]][b]; z = pos[v[i]][c]; w = pos[v[i]][d]; if (x < y && y < z) { if (w < x) va.push_back(v[i]); else if (w < y) vb.push_back(v[i]); else if (w < z) vc.push_back(v[i]); else va.push_back(v[i]); } else if (x < z && z < y) { if (w < x) va.push_back(v[i]); else if (w < z) vc.push_back(v[i]); else if (w < y) vb.push_back(v[i]); else va.push_back(v[i]); } else if (y < x && x < z) { if (w < y) vb.push_back(v[i]); else if (w < x) va.push_back(v[i]); else if (w < z) vc.push_back(v[i]); else vb.push_back(v[i]); } else if (y < z && z < x) { if (w < y) vb.push_back(v[i]); else if (w < z) vc.push_back(v[i]); else if (w < x) va.push_back(v[i]); else vb.push_back(v[i]); } else if (z < x && x < y) { if (w < z) vb.push_back(v[i]); else if (w < x) vc.push_back(v[i]); else if (w < y) va.push_back(v[i]); else vc.push_back(v[i]); } if (va.size() > siz || vb.size() > siz || vc.size() > siz) return 0; } return 1; } bool nadi (vector <int> v) { } void init (int T) { indeksiraj(); } void orderCoins() { int A[] = {0, 1, 2, 3, 4, 5}; answer(A); }

컴파일 시 표준 에러 (stderr) 메시지

scales.cpp: In function 'bool partMin(const std::vector<int>&, int, int, int, int)':
scales.cpp:24:18: warning: conversion to 'int' from 'std::vector<int>::size_type {aka long unsigned int}' may alter its value [-Wconversion]
  int lim = v.size(), x, y, z;
            ~~~~~~^~
scales.cpp:32:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (va.size() > siz || vb.size() > siz || vc.size() > siz) return 0;
       ~~~~~~~~~~^~~~~
scales.cpp:32:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (va.size() > siz || vb.size() > siz || vc.size() > siz) return 0;
                          ~~~~~~~~~~^~~~~
scales.cpp:32:55: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (va.size() > siz || vb.size() > siz || vc.size() > siz) return 0;
                                             ~~~~~~~~~~^~~~~
scales.cpp: In function 'bool partMax(const std::vector<int>&, int, int, int, int)':
scales.cpp:39:18: warning: conversion to 'int' from 'std::vector<int>::size_type {aka long unsigned int}' may alter its value [-Wconversion]
  int lim = v.size(), x, y, z;
            ~~~~~~^~
scales.cpp:47:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (va.size() > siz || vb.size() > siz || vc.size() > siz) return 0;
       ~~~~~~~~~~^~~~~
scales.cpp:47:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (va.size() > siz || vb.size() > siz || vc.size() > siz) return 0;
                          ~~~~~~~~~~^~~~~
scales.cpp:47:55: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (va.size() > siz || vb.size() > siz || vc.size() > siz) return 0;
                                             ~~~~~~~~~~^~~~~
scales.cpp: In function 'bool partMed(const std::vector<int>&, int, int, int, int)':
scales.cpp:54:18: warning: conversion to 'int' from 'std::vector<int>::size_type {aka long unsigned int}' may alter its value [-Wconversion]
  int lim = v.size(), x, y, z;
            ~~~~~~^~
scales.cpp:59:13: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   if (y < x && x < z || z < x && x < y) va.push_back(v[i]);
       ~~~~~~^~~~~~~~
scales.cpp:60:13: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   if (x < y && y < z || z < y && y < x) vb.push_back(v[i]);
       ~~~~~~^~~~~~~~
scales.cpp:61:13: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   if (x < z && z < y || y < z && z < x) vc.push_back(v[i]);
       ~~~~~~^~~~~~~~
scales.cpp:62:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (va.size() > siz || vb.size() > siz || vc.size() > siz) return 0;
       ~~~~~~~~~~^~~~~
scales.cpp:62:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (va.size() > siz || vb.size() > siz || vc.size() > siz) return 0;
                          ~~~~~~~~~~^~~~~
scales.cpp:62:55: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (va.size() > siz || vb.size() > siz || vc.size() > siz) return 0;
                                             ~~~~~~~~~~^~~~~
scales.cpp: In function 'bool partMagic(const std::vector<int>&, int, int, int, int, int)':
scales.cpp:69:18: warning: conversion to 'int' from 'std::vector<int>::size_type {aka long unsigned int}' may alter its value [-Wconversion]
  int lim = v.size(), x, y, z, w;
            ~~~~~~^~
scales.cpp:101:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (va.size() > siz || vb.size() > siz || vc.size() > siz) return 0;
       ~~~~~~~~~~^~~~~
scales.cpp:101:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (va.size() > siz || vb.size() > siz || vc.size() > siz) return 0;
                          ~~~~~~~~~~^~~~~
scales.cpp:101:55: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (va.size() > siz || vb.size() > siz || vc.size() > siz) return 0;
                                             ~~~~~~~~~~^~~~~
scales.cpp: In function 'bool nadi(std::vector<int>)':
scales.cpp:108:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
scales.cpp:106:25: warning: unused parameter 'v' [-Wunused-parameter]
 bool nadi (vector <int> v) {
                         ^
scales.cpp: In function 'void init(int)':
scales.cpp:110:16: warning: unused parameter 'T' [-Wunused-parameter]
 void init (int T) {
                ^
#Verdict Execution timeMemoryGrader output
Fetching results...