# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
107446 | SamAnd | Highway design (CEOI12_highway) | C++17 | 3 ms | 804 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;
const int N = 100005;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int n;
int a[N];
int main()
{
for (int i = 1; i <= n; ++i)
a[i] = i;
for (int i = n; i >= 1; --i)
{
int j = rnd() % i + 1;
swap(a[i], a[j]);
}
n = GetN();
if (isOnLine(1, 2, 3))
{
int x = -1, y = -1;
for (int j = 1; j <= n; ++j)
{
int i = a[j];
if (i < 4)
continue;
if (!isOnLine(1, 2, i))
{
if (x == -1)
x = i;
else
{
y = i;
Answer(1, 2, x, y);
return 0;
}
}
}
}
else
{
if (isOnLine(1, 2, 4))
{
int x = 3, y = -1;
for (int j = 1; j <= n; ++j)
{
int i = a[j];
if (i < 5)
continue;
if (!isOnLine(1, 2, i))
{
y = i;
Answer(1, 2, x, y);
return 0;
}
}
}
else if (isOnLine(1, 3, 4))
{
int x = 2, y = -1;
for (int j = 1; j <= n; ++j)
{
int i = a[j];
if (i < 5)
continue;
if (!isOnLine(1, 3, i))
{
y = i;
Answer(1, 3, x, y);
return 0;
}
}
}
else
{
int x = 1, y = -1;
for (int j = 1; j <= n; ++j)
{
int i = a[j];
if (i < 5)
continue;
if (!isOnLine(2, 3, i))
{
y = i;
Answer(2, 3, x, y);
return 0;
}
}
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |