답안 #213128

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
213128 2020-03-25T03:49:42 Z combi1k1 함박 스테이크 (JOI20_hamburg) C++14
21 / 100
3000 ms 6648 KB
#include<bits/stdc++.h>

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 2e5 + 5;

typedef pair<int,int>   ii;

struct Rec  {
    int l, r;
    int u, d;
}   a[N];
Rec p[4];
Rec inf;

Rec operator & (const Rec&a,const Rec&b)    {
    Rec c;
    c.l = max(a.l,b.l);
    c.u = max(a.u,b.u);
    c.r = min(a.r,b.r);
    c.d = min(a.d,b.d);

    return  c;
}

int main()  {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    srand(time(NULL));

    int n;  cin >> n;
    int k;  cin >> k;

    inf.l = inf.u = 1;
    inf.r = inf.d = 1e9 ;

    vector<int> v1;
    vector<int> v2;

    for(int i = 0 ; i < n ; ++i)    {
        cin >> a[i].l >> a[i].u;
        cin >> a[i].r >> a[i].d;

        v2.push_back(i);
    }

    while (1)   {
        vector<int> nxt = v2;   v2.clear();

        fill(p,p + k,inf);

        for(int i : nxt)    {
            bool ok = 0;
            for(int j = 0 ; j < k ; ++j)    {
                Rec T = p[j] & a[i];

                if (T.l > T.r)  continue;
                if (T.u > T.d)  continue;

                p[j] = T;
                ok = 1;
                break;
            }
            if (ok) v1.pb(i);
            else    v2.pb(i);
        }
        if (v2.empty()) {
            for(int i = 0 ; i < k ; ++i)
                cout << p[i].l << " " << p[i].u << "\n";

            return  0;
        }
        //random_shuffle(all(v2));
        v2.insert(v2.end(),v1.begin(),v1.end());
        v1.clear();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 360 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 1 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 2 ms 384 KB Output is correct
40 Correct 1 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 3 ms 384 KB Output is correct
43 Correct 2 ms 384 KB Output is correct
44 Correct 2 ms 384 KB Output is correct
45 Correct 2 ms 384 KB Output is correct
46 Correct 2 ms 384 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 2 ms 384 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
50 Correct 1 ms 384 KB Output is correct
51 Correct 2 ms 384 KB Output is correct
52 Correct 2 ms 384 KB Output is correct
53 Correct 2 ms 384 KB Output is correct
54 Correct 2 ms 384 KB Output is correct
55 Correct 2 ms 384 KB Output is correct
56 Correct 2 ms 384 KB Output is correct
57 Correct 2 ms 384 KB Output is correct
58 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 95 ms 6552 KB Output is correct
6 Correct 96 ms 6636 KB Output is correct
7 Correct 106 ms 6636 KB Output is correct
8 Correct 114 ms 6620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 119 ms 6584 KB Output is correct
6 Correct 103 ms 6512 KB Output is correct
7 Correct 101 ms 6640 KB Output is correct
8 Correct 122 ms 6640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 143 ms 6580 KB Output is correct
14 Correct 111 ms 6636 KB Output is correct
15 Correct 106 ms 6600 KB Output is correct
16 Correct 100 ms 6636 KB Output is correct
17 Correct 108 ms 6640 KB Output is correct
18 Correct 109 ms 6616 KB Output is correct
19 Correct 111 ms 6612 KB Output is correct
20 Correct 106 ms 6636 KB Output is correct
21 Correct 111 ms 6544 KB Output is correct
22 Correct 105 ms 6648 KB Output is correct
23 Correct 108 ms 6588 KB Output is correct
24 Correct 104 ms 6512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 360 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 1 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 2 ms 384 KB Output is correct
40 Correct 1 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 3 ms 384 KB Output is correct
43 Correct 2 ms 384 KB Output is correct
44 Correct 2 ms 384 KB Output is correct
45 Correct 2 ms 384 KB Output is correct
46 Correct 2 ms 384 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 2 ms 384 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
50 Correct 1 ms 384 KB Output is correct
51 Correct 2 ms 384 KB Output is correct
52 Correct 2 ms 384 KB Output is correct
53 Correct 2 ms 384 KB Output is correct
54 Correct 2 ms 384 KB Output is correct
55 Correct 2 ms 384 KB Output is correct
56 Correct 2 ms 384 KB Output is correct
57 Correct 2 ms 384 KB Output is correct
58 Correct 1 ms 384 KB Output is correct
59 Correct 122 ms 6636 KB Output is correct
60 Correct 220 ms 6512 KB Output is correct
61 Correct 127 ms 6512 KB Output is correct
62 Correct 105 ms 6568 KB Output is correct
63 Correct 110 ms 6512 KB Output is correct
64 Correct 124 ms 6644 KB Output is correct
65 Correct 150 ms 6552 KB Output is correct
66 Correct 123 ms 6512 KB Output is correct
67 Correct 111 ms 6512 KB Output is correct
68 Correct 128 ms 6568 KB Output is correct
69 Correct 120 ms 6516 KB Output is correct
70 Correct 117 ms 6612 KB Output is correct
71 Correct 126 ms 6636 KB Output is correct
72 Correct 129 ms 6612 KB Output is correct
73 Correct 108 ms 6640 KB Output is correct
74 Correct 128 ms 6636 KB Output is correct
75 Correct 129 ms 6636 KB Output is correct
76 Correct 121 ms 6516 KB Output is correct
77 Correct 165 ms 6640 KB Output is correct
78 Correct 111 ms 6632 KB Output is correct
79 Correct 113 ms 6640 KB Output is correct
80 Correct 114 ms 6512 KB Output is correct
81 Correct 137 ms 6616 KB Output is correct
82 Correct 108 ms 6512 KB Output is correct
83 Correct 118 ms 6636 KB Output is correct
84 Correct 140 ms 6636 KB Output is correct
85 Correct 122 ms 6640 KB Output is correct
86 Correct 158 ms 6640 KB Output is correct
87 Correct 128 ms 6604 KB Output is correct
88 Correct 111 ms 6544 KB Output is correct
89 Correct 108 ms 6560 KB Output is correct
90 Correct 131 ms 6636 KB Output is correct
91 Correct 118 ms 6616 KB Output is correct
92 Correct 134 ms 6516 KB Output is correct
93 Correct 109 ms 6528 KB Output is correct
94 Correct 127 ms 6608 KB Output is correct
95 Correct 140 ms 6636 KB Output is correct
96 Execution timed out 3079 ms 6536 KB Time limit exceeded
97 Halted 0 ms 0 KB -