# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
136372 | ainta | Meandian (CEOI06_meandian) | C++17 | 8 ms | 376 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<cstdio>
#include<algorithm>
using namespace std;
int arr[100];
int Go(int *w) {
int i, T[5], j;
for (i = 0; i < 5; i++) {
T[i] = Meandian(w[(i + 1) % 5], w[(i + 2) % 5], w[(i + 3) % 5], w[(i + 4) % 5]);
}
int pv;
for (i = 0; i < 5; i++) {
for (j = 0; j < 5; j++) {
if (i != j && T[i] == T[j])break;
}
if (j == 5)pv = i;
}
sort(T, T + 5);
arr[w[pv]-1] = T[1] + T[3] - T[2];
return w[pv];
}
int main(void)
{
int i, n;
int foo, bar, quux;
n = Init();
for (i = 0; i < n; i++)arr[i] = -1;
int w[5];
for (i = 1; i <= 4; i++)w[i - 1] = i;
int pv = 4;
for (i = 5; i <= n; i++) {
w[pv] = i;
int z = Go(w);
for (int j = 0; j < 5; j++)if (w[j] == z)pv = j;
}
Solution(arr);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |