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 <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;
void pr(int i) {
if (i == 0) printf("FACE\n");
if (i == 1) printf("LINE\n");
if (i == 2) printf("POINT\n");
if (i == 3) printf("NULL\n");
exit(0);
}
struct ev {
int x;
int y1, y2;
int t;
bool operator<(const ev &p) const {
if (x != p.x) return x < p.x;
return t < p.t;
}
};
int col(int x1, int x2, int y1, int x3, int x4, int y2) {
if (y1 != y2) return 0;
if (x2 <= x3) return 0;
if (x4 <= x1) return 0;
return 1;
}
int main() {
int x1, y1, x2, y2, x3, y3, x4, y4;
scanf("%d%d%d%d%d%d%d%d", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
vector<ev> v;
v.push_back({ x1, y1, y2, 1 });
v.push_back({ x2, y1, y2, 0 });
v.push_back({ x3, y3, y4, 1 });
v.push_back({ x4, y3, y4, 0 });
sort(v.begin(), v.end());
set<pii> mp;
for (ev i : v) {
if (i.t) {
if (mp.size()) {
pii x = *mp.begin();
if (x.first < i.y2 && i.y1 < x.second) pr(0);
}
mp.emplace(i.y1, i.y2);
}
else {
mp.erase(pii(i.y1, i.y2));
}
}
if (col(x1, x2, y1, x3, x4, y4)) pr(1);
if (col(x1, x2, y2, x3, x4, y3)) pr(1);
if (col(y1, y2, x1, y3, y4, x4)) pr(1);
if (col(y1, y2, x2, y3, y4, x3)) pr(1);
set<int> xs;
xs.insert(x1);
xs.insert(x2);
xs.insert(x3);
xs.insert(x4);
set<int> ys;
ys.insert(y1);
ys.insert(y2);
ys.insert(y3);
ys.insert(y4);
if (xs.size() < 4 && ys.size() < 4) pr(2);
pr(3);
return 0;
}
Compilation message (stderr)
box.cpp: In function 'int main()':
box.cpp:48:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d%d%d%d%d%d", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |