# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
247062 | eggag32 | Highway design (CEOI12_highway) | C++17 | 6 ms | 692 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include "office.h"
//#include "office.cpp"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))
template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
//freopen("input.in", "r", stdin);
//freopen("output.out", "w", stdout);
int n = GetN();
int a = -1, b = -1;
repn(i, 1, 6) repn(j, i + 1, 6) repn(k, j + 1, 6){
if(isOnLine(i, j, k)){
a = i, b = j;
break;
}
}
int c = -1, d = -1;
int st = 3;
while(true){
int st1 = st + 1;
while(st1 == a || st1 == b || st1 == c || st1 == d) st1++;
while(st == a || st == b || st == st1 || st == c || st == d) st++;
if(st1 <= n && st <= n){
if(!isOnLine(a, st, st1)){
if(!isOnLine(a, b, st)){
if(c == -1) c = st;
else if(d == -1) d = st;
}
if(c != -1 && d != -1) break;
if(!isOnLine(a, b, st1)){
if(c == -1) c = st1;
else if(d == -1) d = st1;
}
}
}
else if(st1 > n && st <= n){
if(!isOnLine(a, b, st)){
if(c == -1) c = st;
else if(d == -1) d = st;
}
}
else if(st1 <= n && st > n){
if(!isOnLine(a, b, st1)){
if(c == -1) c = st1;
else if(d == -1) d = st1;
}
}
if(st > n && st1 > n) break;
if(c != -1 && d != -1) break;
st = st1 + 1;
}
Answer(a, b, c, d);
return 0;
}
/*
Things to look out for:
- Integer overflows
- Array bounds
- Special cases
Be careful!
*/
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |