# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
366117 | ijxjdjd | Highway design (CEOI12_highway) | C++14 | 2 ms | 1392 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"
#define FR(i, N) for (int i = 0; i < int(N); i++)
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
//
//int isOnLine(int a, int j, int k) {
// return 1;
//}
//int GetN() {
// return 1;
//}
//void Answer(int a, int b, int c, int d) {
//}
int main() {
cin.tie(0);
cin.sync_with_stdio(0);
int N = GetN();
bool first = isOnLine(1, 2, 3);
bool second = isOnLine(4, 5, 6);
if (first) {
vector<int> left;
for (int i = 4; i <= N; i++) {
left.push_back(i);
}
vector<int> ans;
for (int i = 0; i < left.size(); i+=2) {
if (!isOnLine(1, left[i], (i+1 < left.size() ? left[i+1] : 2))) {
if (!isOnLine(1, 2, left[i])) {
ans.push_back(left[i]);
}
else {
ans.push_back(left[i+1]);
}
if (ans.size() == 2) {
Answer(ans[0], ans[1], 1, 2);
}
}
}
}
else if (second) {
vector<int> left;
for (int i = 1; i <= N; i++) {
if (i < 4 || i > 6) {
left.push_back(i);
}
}
vector<int> ans;
for (int i = 0; i < left.size(); i+=2) {
if (!isOnLine(1, left[i], (i+1 < left.size() ? left[i+1] : 2))) {
if (!isOnLine(1, 2, left[i])) {
ans.push_back(left[i]);
}
else {
ans.push_back(left[i+1]);
}
if (ans.size() == 2) {
Answer(ans[0], ans[1], 1, 2);
}
}
}
}
else {
pair<pair<int, int>, int> pos[3] = {{{1, 2}, 3}, {{2, 3}, 1}, {{1, 3}, 2}};
for (auto& p : pos) {
for (int j = 4; j <= 6; j++) {
if (isOnLine(p.first.first, p.first.second, j)) {
for (int j = 4; j <= 6; j++) {
if (!isOnLine(p.first.first, p.first.second, j)) {
Answer(p.first.first, p.first.second, j, p.second);
}
}
}
}
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |