# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
78561 | hamzqq9 | Highway design (CEOI12_highway) | C++14 | 5 ms | 2236 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 <stdlib.h>
#include <iostream>
#include <string>
#include "office.h"
#define _MaxN 100001
#include<vector>
using namespace std;
#define pb push_back
int pro[100005];
int main() {
// freopen("in.txt","r",stdin);
int n=GetN();
int g=0;
vector<int> ans[2];
for(int i=1;i<n;i+=2) {
if(i+2<=n) {
if(isOnLine(i,i+1,i+2)) {
if(!pro[i]) ans[g].pb(i),pro[i]=1;
if(!pro[i+1]) ans[g].pb(i+1),pro[i+1]=1;
if(!pro[i+2]) ans[g].pb(i+2),pro[i+2]=1;
}
else {
g=!g;
pro[i+1]=1;
if(!pro[i]) ans[g].pb(i),pro[i]=1;
if(!pro[i+1]) ans[g].pb(i+1),pro[i+1]=1;
if(!pro[i+2]) ans[g].pb(i+2),pro[i+2]=1;
}
}
else {
if(isOnLine(i-1,i,i+1)) {
if(!pro[i-1]) ans[g].pb(i-1),pro[i-1]=1;
if(!pro[i]) ans[g].pb(i),pro[i]=1;
if(!pro[i+1]) ans[g].pb(i+1),pro[i+1]=1;
}
else {
g=!g;
pro[i]=1;
if(!pro[i-1]) ans[g].pb(i-1),pro[i-1]=1;
if(!pro[i]) ans[g].pb(i),pro[i]=1;
if(!pro[i+1]) ans[g].pb(i+1),pro[i+1]=1;
}
}
}
Answer(ans[0][0],ans[0][1],ans[1][0],ans[1][1]);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |