# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
113357 | ckodser | Highway design (CEOI12_highway) | C++14 | 3 ms | 640 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"
#define isOnline isOnLine
#define pb push_back
using namespace std;
void Type3(int n)
{
for (int i = 1; i <= 4; i++)
for (int j = i + 1; j <= 4; j++)
if (isOnline(i, j, 5))
{
int a = 1, b = 1;
while (b == i || b == j) b ++;
while (a == i || a == j || a == b) a ++;
Answer(i, j, a, b);
}
exit(13);
}
void Type1(int n)
{
vector < int > vec;
for (int i = 4; i + 1 <= n && (int)vec.size() < 2; i += 2)
if (!isOnline(1, i, i + 1))
{
if (!isOnline(1, 2, i))
vec.push_back(i);
else
vec.push_back(i + 1);
}
if (vec.size() < 2)
vec.pb(n);
Answer(1, 2, vec[0], vec[1]);
}
void Type2(int n, int a, int b, int c)
{
int d = 1 + 2 + 3 + 4 - a - b - c;
vector < int > vec;
vec.push_back(d);
for (int i = 5; i + 2 <= n && (int)vec.size() < 2; i += 2)
if (!isOnline(a, i, i + 1))
{
if (!isOnline(a, b, i))
vec.push_back(i);
else
vec.push_back(i + 1);
}
if (vec.size() < 2)
vec.push_back(n);
Answer(a, b, vec[0], vec[1]);
}
int main()
{
int n = GetN();
if (isOnline(1, 2, 3))
Type1(n);
else if (isOnline(1, 2, 4))
Type2(n, 1, 2, 4);
else if (isOnline(1, 3, 4))
Type2(n, 1, 3, 4);
else if (isOnline(2, 3, 4))
Type2(n, 2, 3, 4);
else
Type3(n);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |