# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
117350 | JohnTitor | 고속도로 설계 (CEOI12_highway) | C++11 | 10 ms | 1404 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=(j); i<=(k); i++)
#define FFOR(i, j, k) for(int i=(j); i<(k); i++)
#define DFOR(i, j, k) for(int i=(j); i>=(k); i--)
#define bug(x) cerr<<#x<<" = "<<(x)<<'\n'
#define pb push_back
#define mp make_pair
#define bit(s, i) (((s)>>(i))&1LL)
#define mask(i) ((1LL<<(i)))
#define builtin_popcount __builtin_popcountll
#define __builtin_popcount __builtin_popcountll
using ll=long long; using ld=long double;
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); const ld pi=acos(0)*2;
template <typename T> inline void read(T &x){char c; bool nega=0; while((!isdigit(c=getchar()))&&(c!='-')); if(c=='-'){nega=1; c=getchar();} x=c-48; while(isdigit(c=getchar())) x=x*10+c-48; if(nega) x=-x;}
template <typename T> inline void writep(T x){if(x>9) writep(x/10); putchar(x%10+48);}
template <typename T> inline void write(T x){if(x<0){ putchar('-'); x=-x;} writep(x);}
template <typename T> inline void writeln(T x){write(x); putchar('\n');}
#define taskname "Highway"
#ifdef Aria
void Answer(int a, int b, int c, int d){}
bool isOnLine(int a, int b, int c){}
int GetN(){};
#else
#include "office.h"
#endif // Aria
int n;
int a=1;
int x, y, z, t;
void answer(int a, int b, int c, int d){
// assert(a);
// assert(b);
// assert(c);
// assert(d);
// assert(a!=b);
// assert(a!=c);
// assert(a!=d);
// assert(b!=c);
// assert(b!=d);
// assert(c!=d);
Answer(a, b, c, d);
exit(0);
}
bool isonline(int a, int b, int c){
// assert(a);
// assert(b);
// assert(c);
// assert(a!=b);
// assert(a!=c);
// assert(b!=c);
return isOnLine(a, b, c);
}
vector <int> all;
int main(){
n=GetN();
FOR(i, 1, n) all.pb(i);
shuffle(all.begin(), all.end(), rng);
a=all.back();
all.pop_back();
// bool bad=1;
while(true){
int b=all.back();
all.pop_back();
int c=all.back();
all.pop_back();
if(isonline(a, b, c)){
continue;
}
else{
// assert(all.size());
int d=all.back();
all.pop_back();
if(isonline(a, b, d)){
x=a;
y=b;
z=c;
}
else if(isonline(a, c, d)){
x=a;
y=c;
z=b;
}
else{
x=b;
y=c;
z=a;
// if(t) answer(x, y, z, t);
all.pb(d);
}
// bad=0;
break;
}
}
// assert(0);
FOR(p, 1, n){
if(p==x||p==y||p==z) continue;
if(!isonline(x, y, p)){
t=p;
break;
}
}
// while(true){
// int p=all.back();
// all.pop_back();
//// int q=all.back();
//// all.pop_back();
//// if(isonline(x, p, q)) continue;
// if(!isonline(x, y, p)){
// t=p;
// break;
// }
// }
answer(x, y, z, t);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |