# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
286389 | Kastanda | 고속도로 설계 (CEOI12_highway) | C++11 | 1 ms | 768 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// M
#include<bits/stdc++.h>
#include "office.h"
using namespace std;
const int N = 100005;
int main()
{
int n = GetN();
if (isOnLine(1, 2, 3))
{
vector < int > vec;
for (int i = 4; i + 1 <= n && (int)vec.size() <= 1; i += 2)
if (!isOnLine(1, i, i + 1))
vec.push_back(i);
if ((int)vec.size() == 2)
{
int a = vec[0] + (int)isOnLine(1, 2, vec[0]);
int b = vec[1] + (int)isOnLine(1, 2, vec[1]);
Answer(1, 2, a, b);
return 0;
}
assert((int)vec.size());
if (n % 2 == 1)
{
Answer(1, 2, vec[0], vec[0] + 1);
return 0;
}
if (isOnLine(1, 2, vec[0]))
{
Answer(1, 2, vec[0] + 1, n);
return 0;
}
if (isOnLine(1, 2, vec[0] + 1))
{
Answer(1, 2, vec[0], n);
return 0;
}
Answer(1, 2, vec[0], vec[0] + 1);
return 0;
}
int traitor = -1;
if (isOnLine(1, 2, 4))
traitor = 3;
else if (isOnLine(1, 3, 4))
traitor = 2;
else if (isOnLine(2, 3, 4))
traitor = 1;
if (traitor == -1)
{
for (int i = 1; i <= 4; i ++)
for (int j = i + 1; j <= 4; j ++)
if (isOnLine(i, j, 5))
{
int a = 1;
while (a == i || a == j)
a ++;
int b = a + 1;
while (b == i || b == j)
b ++;
Answer(i, j, a, b);
return 0;
}
}
int good_samaritan_1 = (traitor == 1) ? 2 : 1;
int good_samaritan_2 = (traitor <= 2) ? 3 : 2;
vector < int > vec;
for (int i = 5; i + 1 <= n && !(int)vec.size(); i += 2)
if (!isOnLine(good_samaritan_1, i, i + 1))
vec.push_back(i);
if (!(int)vec.size())
{
assert(n % 2 == 1);
Answer(good_samaritan_1, good_samaritan_2, traitor, n);
return 0;
}
if (isOnLine(good_samaritan_1, good_samaritan_2, vec[0]))
Answer(good_samaritan_1, good_samaritan_2, traitor, vec[0] + 1);
else
Answer(good_samaritan_1, good_samaritan_2, traitor, vec[0]);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |