# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
941703 | benjaminkleyn | Highway design (CEOI12_highway) | C++17 | 1 ms | 600 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 "office.h"
using namespace std;
typedef long long ll;
int main()
{
cin.tie(0)->sync_with_stdio(0);
int n = GetN();
vector<int> otherline;
int a, b;
if (isOnLine(1, 2, 3))
{
// [{1, 2, 3}]
a = 1;
b = 2;
if (!isOnLine(1, 2, 4))
otherline.push_back(4);
}
else if (isOnLine(1, 2, 4))
{
// [{1, 2}, {3}]
a = 1;
b = 2;
otherline = {3};
}
else if (isOnLine(2, 3, 4))
{
// [{2, 3}, {1}]
a = 2;
b = 3;
otherline = {1};
}
else if (isOnLine(2, 3, 4))
{
// [{3, 1}, {2}]
a = 1;
b = 3;
otherline = {2};
}
else
{
// [{1, 2}, {3, 4}] or [{1, 3}, {2, 4}] or [{2, 3}, {1, 4}].
if (isOnLine(1, 2, 5) || isOnLine(3, 4, 5))
{
Answer(1, 2, 3, 4);
return 0;
}
if (isOnLine(1, 3, 5) || isOnLine(2, 4, 5))
{
Answer(1, 3, 2, 4);
return 0;
}
Answer(2, 3, 1, 4);
return 0;
}
for (int i = 5; i + 1 <= n && otherline.size() < 2; i += 2)
{
if (isOnLine(a, i, i + 1))
continue;
if (isOnLine(a, b, i + 1))
otherline.push_back(i);
else if (isOnLine(a, b, i))
otherline.push_back(i + 1);
else
{
otherline.push_back(i);
otherline.push_back(i + 1);
break;
}
}
if (n % 2 && otherline.size() < 2)
otherline.push_back(n);
Answer(a, b, otherline[0], otherline[1]);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |