# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
370425 | arnold518 | Highway design (CEOI12_highway) | C++14 | 53 ms | 7396 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;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int N;
int GetN(void);
int isOnLine(int x, int y, int z);
void Answer(int a1, int b1, int a2, int b2);
map<tuple<int, int, int>, int> M;
int query(int a, int b, int c)
{
if(a>b) swap(a, b);
if(b>c) swap(b, c);
if(a>b) swap(a, b);
if(M.find({a, b, c})!=M.end()) return M[{a, b, c}];
M[{a, b, c}]=isOnLine(a, b, c);
return M[{a, b, c}];
}
vector<int> V[2];
int main()
{
N=GetN();
int a, b, c;
for(int i=1; i<=5; i++)
{
for(int j=i+1; j<=5; j++)
{
for(int k=j+1; k<=5; k++)
{
if(query(i, j, k))
{
a=i; b=j; c=k;
break;
}
}
}
}
V[0].push_back(a);
V[0].push_back(b);
V[0].push_back(c);
for(int i=1; i<=N; i++)
{
if(i==a) continue;
if(i==b) continue;
if(i==c) continue;
if(query(a, b, i))
{
V[0].push_back(i);
}
else
{
V[1].push_back(i);
}
if(V[0].size()>1 && V[1].size()>1)
{
Answer(V[0][0], V[0][1], V[1][0], V[1][1]);
break;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |