답안 #65665

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
65665 2018-08-08T11:11:48 Z imeimi2000 두 박스 (KOI18_box) C++17
100 / 100
4 ms 1060 KB
#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

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);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 476 KB Output is correct
4 Correct 2 ms 476 KB Output is correct
5 Correct 2 ms 516 KB Output is correct
6 Correct 2 ms 568 KB Output is correct
7 Correct 2 ms 680 KB Output is correct
8 Correct 2 ms 740 KB Output is correct
9 Correct 2 ms 740 KB Output is correct
10 Correct 3 ms 740 KB Output is correct
11 Correct 2 ms 740 KB Output is correct
12 Correct 3 ms 740 KB Output is correct
13 Correct 2 ms 740 KB Output is correct
14 Correct 2 ms 740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 740 KB Output is correct
2 Correct 2 ms 740 KB Output is correct
3 Correct 4 ms 908 KB Output is correct
4 Correct 2 ms 908 KB Output is correct
5 Correct 2 ms 908 KB Output is correct
6 Correct 2 ms 908 KB Output is correct
7 Correct 2 ms 908 KB Output is correct
8 Correct 2 ms 908 KB Output is correct
9 Correct 2 ms 908 KB Output is correct
10 Correct 2 ms 908 KB Output is correct
11 Correct 3 ms 908 KB Output is correct
12 Correct 4 ms 908 KB Output is correct
13 Correct 3 ms 908 KB Output is correct
14 Correct 3 ms 908 KB Output is correct
15 Correct 3 ms 908 KB Output is correct
16 Correct 3 ms 908 KB Output is correct
17 Correct 3 ms 908 KB Output is correct
18 Correct 3 ms 908 KB Output is correct
19 Correct 3 ms 908 KB Output is correct
20 Correct 3 ms 908 KB Output is correct
21 Correct 3 ms 908 KB Output is correct
22 Correct 3 ms 908 KB Output is correct
23 Correct 3 ms 908 KB Output is correct
24 Correct 4 ms 908 KB Output is correct
25 Correct 3 ms 908 KB Output is correct
26 Correct 3 ms 908 KB Output is correct
27 Correct 2 ms 908 KB Output is correct
28 Correct 3 ms 908 KB Output is correct
29 Correct 3 ms 908 KB Output is correct
30 Correct 2 ms 908 KB Output is correct
31 Correct 2 ms 908 KB Output is correct
32 Correct 3 ms 908 KB Output is correct
33 Correct 2 ms 908 KB Output is correct
34 Correct 2 ms 908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 476 KB Output is correct
4 Correct 2 ms 476 KB Output is correct
5 Correct 2 ms 516 KB Output is correct
6 Correct 2 ms 568 KB Output is correct
7 Correct 2 ms 680 KB Output is correct
8 Correct 2 ms 740 KB Output is correct
9 Correct 2 ms 740 KB Output is correct
10 Correct 3 ms 740 KB Output is correct
11 Correct 2 ms 740 KB Output is correct
12 Correct 3 ms 740 KB Output is correct
13 Correct 2 ms 740 KB Output is correct
14 Correct 2 ms 740 KB Output is correct
15 Correct 3 ms 740 KB Output is correct
16 Correct 2 ms 740 KB Output is correct
17 Correct 4 ms 908 KB Output is correct
18 Correct 2 ms 908 KB Output is correct
19 Correct 2 ms 908 KB Output is correct
20 Correct 2 ms 908 KB Output is correct
21 Correct 2 ms 908 KB Output is correct
22 Correct 2 ms 908 KB Output is correct
23 Correct 2 ms 908 KB Output is correct
24 Correct 2 ms 908 KB Output is correct
25 Correct 3 ms 908 KB Output is correct
26 Correct 4 ms 908 KB Output is correct
27 Correct 3 ms 908 KB Output is correct
28 Correct 3 ms 908 KB Output is correct
29 Correct 3 ms 908 KB Output is correct
30 Correct 3 ms 908 KB Output is correct
31 Correct 3 ms 908 KB Output is correct
32 Correct 3 ms 908 KB Output is correct
33 Correct 3 ms 908 KB Output is correct
34 Correct 3 ms 908 KB Output is correct
35 Correct 3 ms 908 KB Output is correct
36 Correct 3 ms 908 KB Output is correct
37 Correct 3 ms 908 KB Output is correct
38 Correct 4 ms 908 KB Output is correct
39 Correct 3 ms 908 KB Output is correct
40 Correct 3 ms 908 KB Output is correct
41 Correct 2 ms 908 KB Output is correct
42 Correct 3 ms 908 KB Output is correct
43 Correct 3 ms 908 KB Output is correct
44 Correct 2 ms 908 KB Output is correct
45 Correct 2 ms 908 KB Output is correct
46 Correct 3 ms 908 KB Output is correct
47 Correct 2 ms 908 KB Output is correct
48 Correct 2 ms 908 KB Output is correct
49 Correct 2 ms 908 KB Output is correct
50 Correct 3 ms 908 KB Output is correct
51 Correct 3 ms 908 KB Output is correct
52 Correct 2 ms 908 KB Output is correct
53 Correct 2 ms 908 KB Output is correct
54 Correct 2 ms 908 KB Output is correct
55 Correct 3 ms 908 KB Output is correct
56 Correct 2 ms 964 KB Output is correct
57 Correct 3 ms 964 KB Output is correct
58 Correct 3 ms 964 KB Output is correct
59 Correct 2 ms 964 KB Output is correct
60 Correct 2 ms 964 KB Output is correct
61 Correct 2 ms 964 KB Output is correct
62 Correct 4 ms 964 KB Output is correct
63 Correct 3 ms 964 KB Output is correct
64 Correct 2 ms 964 KB Output is correct
65 Correct 3 ms 964 KB Output is correct
66 Correct 2 ms 964 KB Output is correct
67 Correct 2 ms 964 KB Output is correct
68 Correct 3 ms 964 KB Output is correct
69 Correct 2 ms 964 KB Output is correct
70 Correct 2 ms 964 KB Output is correct
71 Correct 2 ms 964 KB Output is correct
72 Correct 2 ms 964 KB Output is correct
73 Correct 3 ms 964 KB Output is correct
74 Correct 3 ms 964 KB Output is correct
75 Correct 3 ms 964 KB Output is correct
76 Correct 2 ms 964 KB Output is correct
77 Correct 2 ms 964 KB Output is correct
78 Correct 2 ms 964 KB Output is correct
79 Correct 2 ms 964 KB Output is correct
80 Correct 3 ms 964 KB Output is correct
81 Correct 2 ms 964 KB Output is correct
82 Correct 3 ms 1060 KB Output is correct