# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
130567 | keko37 | Scales (IOI15_scales) | C++14 | 2 ms | 504 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 <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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |