# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
453278 | BT21tata | Highway design (CEOI12_highway) | C++17 | 21 ms | 1100 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"
// #pragma GCC target ("avx,avx2,fma")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef long double ld;
#define SPEED ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0)
#define rall(v) (v).rbegin(),(v).rend()
#define all(v) (v).begin(),(v).end()
#define OK cerr<<"OK"<<endl<<flush
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define F first
#define S second
#define y0 jahdakdh
#define y1 jahsadakdakdh
#define endl '\n'
using namespace std;
const ll MOD=1e9+7;
mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());
int a[100005];
int main()
{
SPEED;
int n=GetN();
bool f=isOnLine(1, 2, 3);
a[1]=a[2]=a[3]=1;
if(!f)
{
while(true)
{
int x=rng()%n+1;
if(a[x]) continue;
f=isOnLine(1, 2, x);
a[x]=1;
if(!f)
{
Answer(1, 2, x, 3);
return 0;
}
}
}
else
{
int cnt=0, num;
while(true)
{
int x=rng()%n+1;
if(a[x]) continue;
f=isOnLine(1, 2, x);
a[x]=1;
if(!f)
{
cnt++;
if(cnt==1) num=x;
if(cnt==2)
{
Answer(1, 2, num, x);
return 0;
}
}
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |