# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
262884 | dolphingarlic | Meandian (CEOI06_meandian) | C++14 | 17 ms | 308 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 "libmean.h"
#include <bits/stdc++.h>
using namespace std;
int ans[100], c[5];
int main() {
int n = Init();
fill(ans, ans + n, -1);
queue<int> cand;
for (int i = 1; i <= n; i++) cand.push(i);
while (cand.size() > 4) {
for (int i = 0; i < 5; i++) {
c[i] = cand.front();
cand.pop();
}
map<int, vector<int>> occ;
occ[Meandian(c[0], c[1], c[2], c[3])].push_back(4);
occ[Meandian(c[0], c[1], c[2], c[4])].push_back(3);
occ[Meandian(c[0], c[1], c[3], c[4])].push_back(2);
occ[Meandian(c[0], c[2], c[3], c[4])].push_back(1);
occ[Meandian(c[1], c[2], c[3], c[4])].push_back(0);
int found, val = 0;
for (pair<int, vector<int>> i : occ) {
if (i.second.size() == 1) {
found = i.second[0];
val -= i.first;
} else val += i.first;
}
ans[found - 1] = val;
for (int i = 0; i < 5; i++) if (c[i] != found) cand.push(c[i]);
}
Solution(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |