답안 #289948

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
289948 2020-09-03T08:57:46 Z mhy908 함박 스테이크 (JOI20_hamburg) C++14
21 / 100
3000 ms 6292 KB
#include <bits/stdc++.h>
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int inf=1e9;

int n, k;
pair<pii, pii> rct[200010], ans[5];
vector<int> vc;

int main(){
    srand(time(NULL));
    scanf("%d %d", &n, &k);
    for(int i=1; i<=n; i++)scanf("%d %d %d %d", &rct[i].F.F, &rct[i].F.S, &rct[i].S.F, &rct[i].S.S);
    for(int i=1; i<=n; i++)vc.eb(i);
    while(1){
        vector<int> n, y;
        for(int i=1; i<=k; i++)ans[i]=mp(mp(1, 1), mp(inf, inf));
        for(auto i:vc){
            bool flg2=false;
            for(int j=1; j<=k; j++){
                int sx=max(rct[i].F.F, ans[j].F.F);
                int sy=max(rct[i].F.S, ans[j].F.S);
                int ex=min(rct[i].S.F, ans[j].S.F);
                int ey=min(rct[i].S.S, ans[j].S.S);
                if(sx<=ex&&sy<=ey){
                    ans[j]=mp(mp(sx, sy), mp(ex, ey));
                    flg2=true;
                    break;
                }
            }
            if(!flg2)n.eb(i);
            else y.eb(i);
        }
        if(!n.size())break;
        vc.clear();
        for(auto i:n)vc.eb(i);
        for(auto i:y)vc.eb(i);
    }
    for(int i=1; i<=k; i++)printf("%d %d\n", ans[i].F.F, ans[i].F.S);
    return 0;
}

Compilation message

hamburg.cpp: In function 'int main()':
hamburg.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   18 |     scanf("%d %d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~
hamburg.cpp:19:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   19 |     for(int i=1; i<=n; i++)scanf("%d %d %d %d", &rct[i].F.F, &rct[i].F.S, &rct[i].S.F, &rct[i].S.S);
      |                            ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 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 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 416 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 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 3 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 416 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 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 512 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 360 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 3 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 3 ms 384 KB Output is correct
25 Correct 3 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 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 2 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 2 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 3 ms 384 KB Output is correct
41 Correct 3 ms 384 KB Output is correct
42 Correct 2 ms 416 KB Output is correct
43 Correct 3 ms 384 KB Output is correct
44 Correct 2 ms 384 KB Output is correct
45 Correct 3 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 3 ms 384 KB Output is correct
50 Correct 3 ms 384 KB Output is correct
51 Correct 3 ms 384 KB Output is correct
52 Correct 3 ms 384 KB Output is correct
53 Correct 2 ms 384 KB Output is correct
54 Correct 4 ms 360 KB Output is correct
55 Correct 3 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 2 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 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 140 ms 5740 KB Output is correct
6 Correct 152 ms 5768 KB Output is correct
7 Correct 138 ms 5740 KB Output is correct
8 Correct 149 ms 5740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 416 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 184 ms 5984 KB Output is correct
6 Correct 147 ms 6048 KB Output is correct
7 Correct 150 ms 6036 KB Output is correct
8 Correct 151 ms 6056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 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 3 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 416 KB Output is correct
13 Correct 147 ms 6112 KB Output is correct
14 Correct 158 ms 6168 KB Output is correct
15 Correct 152 ms 6016 KB Output is correct
16 Correct 147 ms 6080 KB Output is correct
17 Correct 144 ms 5996 KB Output is correct
18 Correct 145 ms 5992 KB Output is correct
19 Correct 148 ms 6068 KB Output is correct
20 Correct 147 ms 6076 KB Output is correct
21 Correct 146 ms 6048 KB Output is correct
22 Correct 141 ms 6004 KB Output is correct
23 Correct 155 ms 6024 KB Output is correct
24 Correct 169 ms 6048 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 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 512 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 360 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 3 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 3 ms 384 KB Output is correct
25 Correct 3 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 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 2 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 2 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 3 ms 384 KB Output is correct
41 Correct 3 ms 384 KB Output is correct
42 Correct 2 ms 416 KB Output is correct
43 Correct 3 ms 384 KB Output is correct
44 Correct 2 ms 384 KB Output is correct
45 Correct 3 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 3 ms 384 KB Output is correct
50 Correct 3 ms 384 KB Output is correct
51 Correct 3 ms 384 KB Output is correct
52 Correct 3 ms 384 KB Output is correct
53 Correct 2 ms 384 KB Output is correct
54 Correct 4 ms 360 KB Output is correct
55 Correct 3 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 2 ms 384 KB Output is correct
59 Correct 163 ms 6040 KB Output is correct
60 Correct 157 ms 6100 KB Output is correct
61 Correct 160 ms 6112 KB Output is correct
62 Correct 144 ms 6064 KB Output is correct
63 Correct 156 ms 6080 KB Output is correct
64 Correct 144 ms 6064 KB Output is correct
65 Correct 174 ms 6100 KB Output is correct
66 Correct 181 ms 6040 KB Output is correct
67 Correct 149 ms 6100 KB Output is correct
68 Correct 175 ms 6032 KB Output is correct
69 Correct 148 ms 6044 KB Output is correct
70 Correct 170 ms 6084 KB Output is correct
71 Correct 159 ms 6040 KB Output is correct
72 Correct 148 ms 6012 KB Output is correct
73 Correct 156 ms 6080 KB Output is correct
74 Correct 176 ms 6076 KB Output is correct
75 Correct 179 ms 6012 KB Output is correct
76 Correct 156 ms 6076 KB Output is correct
77 Correct 216 ms 6176 KB Output is correct
78 Correct 155 ms 6116 KB Output is correct
79 Correct 165 ms 6080 KB Output is correct
80 Correct 147 ms 6176 KB Output is correct
81 Correct 157 ms 6068 KB Output is correct
82 Correct 164 ms 6096 KB Output is correct
83 Correct 179 ms 6012 KB Output is correct
84 Correct 153 ms 6016 KB Output is correct
85 Correct 176 ms 6048 KB Output is correct
86 Correct 171 ms 6084 KB Output is correct
87 Correct 162 ms 6072 KB Output is correct
88 Correct 168 ms 6084 KB Output is correct
89 Correct 148 ms 6076 KB Output is correct
90 Correct 155 ms 6064 KB Output is correct
91 Correct 178 ms 6004 KB Output is correct
92 Correct 181 ms 6084 KB Output is correct
93 Correct 143 ms 6072 KB Output is correct
94 Correct 199 ms 6068 KB Output is correct
95 Correct 189 ms 6188 KB Output is correct
96 Execution timed out 3086 ms 6292 KB Time limit exceeded
97 Halted 0 ms 0 KB -