Submission #130567

# Submission time Handle Problem Language Result Execution time Memory
130567 2019-07-15T15:14:51 Z keko37 Scales (IOI15_scales) C++14
0 / 100
2 ms 504 KB
#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);
}

Compilation message

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 time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Incorrect 2 ms 380 KB Output isn't correct
7 Incorrect 2 ms 380 KB Output isn't correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Incorrect 2 ms 376 KB Output isn't correct
10 Incorrect 2 ms 376 KB Output isn't correct
11 Incorrect 2 ms 376 KB Output isn't correct
12 Incorrect 2 ms 376 KB Output isn't correct
13 Incorrect 2 ms 376 KB Output isn't correct
14 Incorrect 2 ms 376 KB Output isn't correct
15 Incorrect 2 ms 376 KB Output isn't correct
16 Incorrect 2 ms 376 KB Output isn't correct
17 Incorrect 2 ms 376 KB Output isn't correct
18 Incorrect 2 ms 380 KB Output isn't correct
19 Incorrect 2 ms 376 KB Output isn't correct
20 Incorrect 2 ms 376 KB Output isn't correct
21 Incorrect 2 ms 504 KB Output isn't correct
22 Incorrect 2 ms 376 KB Output isn't correct
23 Incorrect 2 ms 376 KB Output isn't correct
24 Incorrect 2 ms 376 KB Output isn't correct
25 Incorrect 2 ms 376 KB Output isn't correct
26 Incorrect 2 ms 376 KB Output isn't correct
27 Incorrect 2 ms 376 KB Output isn't correct
28 Incorrect 2 ms 376 KB Output isn't correct
29 Incorrect 2 ms 380 KB Output isn't correct
30 Incorrect 2 ms 376 KB Output isn't correct
31 Incorrect 2 ms 376 KB Output isn't correct
32 Incorrect 2 ms 376 KB Output isn't correct
33 Incorrect 2 ms 376 KB Output isn't correct
34 Incorrect 2 ms 376 KB Output isn't correct
35 Incorrect 2 ms 376 KB Output isn't correct
36 Incorrect 2 ms 376 KB Output isn't correct
37 Incorrect 2 ms 376 KB Output isn't correct
38 Incorrect 2 ms 380 KB Output isn't correct
39 Incorrect 2 ms 376 KB Output isn't correct
40 Incorrect 2 ms 376 KB Output isn't correct