# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
237494 | amoo_safar | Highway design (CEOI12_highway) | C++14 | 5 ms | 768 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>
using namespace std;
#ifndef safar
#include "office.h"
#endif
#ifdef safar
int GetN();
int isOnLine(int x, int y, int z);
void Answer(int a1, int b1, int a2, int b2);
#endif
vector<int> V;
int main(){
ios::sync_with_stdio(0);
int n = GetN();
int solo = 0, a1 = 2, b1 = 3, cnt = 0;
if(isOnLine(1, 2, 3)) solo = 4, cnt ++;
if(isOnLine(1, 2, 4)) solo = 3, b1 = 4, cnt ++;
if(isOnLine(1, 3, 4)) solo = 2, a1 = 1, cnt ++;
assert(cnt >= 2);
vector<int> V;
for(int i = 5; i + 1 <= n; i += 2){
if(isOnLine(a1, i, i + 1)) continue;
if(!isOnLine(a1, b1, i)) V.push_back(i);
if(!isOnLine(a1, b1, i + 1)) V.push_back(i + 1);
if(V.size() >= 2){
Answer(a1, b1, V[0], V[1]);
return 0;
}
}
Answer(a1, b1, V[0], n);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |