# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
253250 | keko37 | Highway design (CEOI12_highway) | C++14 | 1 ms | 768 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"office.h"
#include<bits/stdc++.h>
using namespace std;
int n;
/*int GetN () {}
int isOnLine (int x, int y, int z) {}
void Answer(int a1, int b1, int a2, int b2) {}*/
int main () {
n = GetN();
if (isOnLine(1, 2, 3)) {
vector <int> v;
for (int i = 4; i + 1 <= n && v.size() < 2; i += 2) {
if (isOnLine(1, i, i + 1)) continue;
if (isOnLine(2, 3, i) == 0) v.push_back(i); else v.push_back(i + 1);
}
if (v.size() == 1) v.push_back(v.back() + 1);
Answer(1, 2, v[0], v[1]);
} else {
int a = -1, b = -1, c = -1, d = -1;
if (isOnLine(1, 2, 4)) a = 1, b = 2, c = 4, d = 3;
if (isOnLine(1, 3, 4)) a = 1, b = 3, c = 4, d = 2;
if (isOnLine(2, 3, 4)) a = 2, b = 3, c = 4, d = 1;
if (a != -1) {
int res = -1;
for (int i = 5; i + 1 <= n; i += 2) {
if (isOnLine(a, i, i + 1)) continue;
if (i + 3 > n) {
res = i;
} else {
if (isOnLine(b, c, i) == 0) res = i; else res = i + 1;
}
break;
}
Answer(a, b, d, res);
} else {
if (isOnLine(1, 2, 5)) Answer(1, 2, 3, 4);
else if (isOnLine(1, 3, 5)) Answer(1, 3, 2, 4);
else if (isOnLine(1, 4, 5)) Answer(1, 4, 2, 3);
else if (isOnLine(2, 3, 5)) Answer(2, 3, 1, 4);
else if (isOnLine(2, 4, 5)) Answer(2, 4, 1, 3);
else if (isOnLine(3, 4, 5)) Answer(1, 2, 3, 4);
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |