# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
32957 | imaxblue | Highway design (CEOI12_highway) | C++14 | 3 ms | 4536 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;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() (rand() >> 3)*rand()
int GetN();
int isOnLine(int x, int y, int z);
void Answer(int a1, int b1, int a2, int b2);
int n;
pii a, b, c;
vector<pii> v, w;
int main(){
n=GetN();
fox1(l, n) v.pb(mp(l, -1));
while(1){
if (v.size()==2){
a=v.back(); v.pop_back();
b=v.back(); v.pop_back();
Answer(a.x, a.y, b.x, b.y);
}
w.clear();
while(v.size()>=3){
a=v.back(); v.pop_back();
b=v.back(); v.pop_back();
c=v.back(); v.pop_back();
if (!isOnLine(a.x, b.x, c.x)){
if (isOnLine(a.x, a.y, b.x)){
Answer(a.x, a.y, c.x, c.y);
return 0;
} else {
Answer(a.x, a.y, b.x, b.y);
return 0;
}
}
w.pb(mp(a.x, b.x));
}
fox(l, v.size()) w.pb(v[l]);
v=w;
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |