답안 #289834

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
289834 2020-09-03T06:29:00 Z 문홍윤(#5788) 함박 스테이크 (JOI20_hamburg) C++17
21 / 100
3000 ms 6368 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;
        random_shuffle(all(y));
        random_shuffle(all(n));
        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 3 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 3 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 4 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 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 3 ms 384 KB Output is correct
8 Correct 2 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 3 ms 384 KB Output is correct
12 Correct 3 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 3 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 9 ms 384 KB Output is correct
8 Correct 8 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 9 ms 384 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 4 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 4 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 4 ms 384 KB Output is correct
24 Correct 4 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 3 ms 384 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 4 ms 384 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 4 ms 384 KB Output is correct
31 Correct 7 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 5 ms 384 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 4 ms 384 KB Output is correct
36 Correct 7 ms 384 KB Output is correct
37 Correct 4 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 8 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 3 ms 384 KB Output is correct
43 Correct 3 ms 384 KB Output is correct
44 Correct 3 ms 384 KB Output is correct
45 Correct 8 ms 384 KB Output is correct
46 Correct 3 ms 384 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 3 ms 384 KB Output is correct
49 Correct 5 ms 384 KB Output is correct
50 Correct 3 ms 384 KB Output is correct
51 Correct 2 ms 384 KB Output is correct
52 Correct 5 ms 384 KB Output is correct
53 Correct 4 ms 384 KB Output is correct
54 Correct 3 ms 384 KB Output is correct
55 Correct 2 ms 384 KB Output is correct
56 Correct 3 ms 384 KB Output is correct
57 Correct 2 ms 384 KB Output is correct
58 Correct 3 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 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 3 ms 384 KB Output is correct
5 Correct 146 ms 5820 KB Output is correct
6 Correct 146 ms 5740 KB Output is correct
7 Correct 147 ms 5868 KB Output is correct
8 Correct 171 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 4 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 167 ms 5980 KB Output is correct
6 Correct 162 ms 6052 KB Output is correct
7 Correct 161 ms 6000 KB Output is correct
8 Correct 158 ms 5980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 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 3 ms 384 KB Output is correct
8 Correct 2 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 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 165 ms 5988 KB Output is correct
14 Correct 261 ms 6100 KB Output is correct
15 Correct 182 ms 6336 KB Output is correct
16 Correct 157 ms 6080 KB Output is correct
17 Correct 229 ms 6120 KB Output is correct
18 Correct 239 ms 5992 KB Output is correct
19 Correct 205 ms 6048 KB Output is correct
20 Correct 229 ms 6084 KB Output is correct
21 Correct 171 ms 6044 KB Output is correct
22 Correct 189 ms 6076 KB Output is correct
23 Correct 380 ms 6092 KB Output is correct
24 Correct 166 ms 6076 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 3 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 9 ms 384 KB Output is correct
8 Correct 8 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 9 ms 384 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 4 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 4 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 4 ms 384 KB Output is correct
24 Correct 4 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 3 ms 384 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 4 ms 384 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 4 ms 384 KB Output is correct
31 Correct 7 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 5 ms 384 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 4 ms 384 KB Output is correct
36 Correct 7 ms 384 KB Output is correct
37 Correct 4 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 8 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 3 ms 384 KB Output is correct
43 Correct 3 ms 384 KB Output is correct
44 Correct 3 ms 384 KB Output is correct
45 Correct 8 ms 384 KB Output is correct
46 Correct 3 ms 384 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 3 ms 384 KB Output is correct
49 Correct 5 ms 384 KB Output is correct
50 Correct 3 ms 384 KB Output is correct
51 Correct 2 ms 384 KB Output is correct
52 Correct 5 ms 384 KB Output is correct
53 Correct 4 ms 384 KB Output is correct
54 Correct 3 ms 384 KB Output is correct
55 Correct 2 ms 384 KB Output is correct
56 Correct 3 ms 384 KB Output is correct
57 Correct 2 ms 384 KB Output is correct
58 Correct 3 ms 384 KB Output is correct
59 Correct 190 ms 6060 KB Output is correct
60 Correct 171 ms 6028 KB Output is correct
61 Correct 155 ms 6068 KB Output is correct
62 Correct 230 ms 5988 KB Output is correct
63 Correct 470 ms 6096 KB Output is correct
64 Correct 170 ms 6100 KB Output is correct
65 Correct 1069 ms 6368 KB Output is correct
66 Correct 507 ms 6100 KB Output is correct
67 Correct 160 ms 5972 KB Output is correct
68 Correct 253 ms 6040 KB Output is correct
69 Correct 416 ms 6080 KB Output is correct
70 Correct 589 ms 6156 KB Output is correct
71 Correct 167 ms 6088 KB Output is correct
72 Correct 217 ms 6056 KB Output is correct
73 Correct 288 ms 6288 KB Output is correct
74 Correct 164 ms 5988 KB Output is correct
75 Correct 822 ms 6240 KB Output is correct
76 Correct 495 ms 6196 KB Output is correct
77 Correct 272 ms 6088 KB Output is correct
78 Correct 596 ms 6100 KB Output is correct
79 Correct 242 ms 6108 KB Output is correct
80 Correct 322 ms 6088 KB Output is correct
81 Correct 331 ms 6164 KB Output is correct
82 Correct 205 ms 6204 KB Output is correct
83 Correct 808 ms 6224 KB Output is correct
84 Correct 1398 ms 6368 KB Output is correct
85 Correct 159 ms 6128 KB Output is correct
86 Correct 1913 ms 6248 KB Output is correct
87 Correct 234 ms 6048 KB Output is correct
88 Correct 721 ms 6108 KB Output is correct
89 Correct 566 ms 6104 KB Output is correct
90 Correct 436 ms 6088 KB Output is correct
91 Correct 252 ms 6064 KB Output is correct
92 Correct 503 ms 6148 KB Output is correct
93 Correct 162 ms 6104 KB Output is correct
94 Correct 985 ms 6140 KB Output is correct
95 Correct 215 ms 6112 KB Output is correct
96 Correct 362 ms 6096 KB Output is correct
97 Correct 482 ms 6092 KB Output is correct
98 Correct 781 ms 6108 KB Output is correct
99 Correct 215 ms 6116 KB Output is correct
100 Correct 263 ms 6064 KB Output is correct
101 Correct 260 ms 6112 KB Output is correct
102 Correct 338 ms 6112 KB Output is correct
103 Correct 196 ms 6008 KB Output is correct
104 Correct 249 ms 6100 KB Output is correct
105 Correct 351 ms 6116 KB Output is correct
106 Correct 196 ms 6108 KB Output is correct
107 Correct 270 ms 6100 KB Output is correct
108 Correct 1182 ms 6100 KB Output is correct
109 Correct 226 ms 6024 KB Output is correct
110 Correct 633 ms 6116 KB Output is correct
111 Correct 846 ms 6236 KB Output is correct
112 Correct 218 ms 6072 KB Output is correct
113 Correct 172 ms 6044 KB Output is correct
114 Correct 186 ms 6028 KB Output is correct
115 Correct 178 ms 6084 KB Output is correct
116 Correct 251 ms 6080 KB Output is correct
117 Execution timed out 3040 ms 6116 KB Time limit exceeded
118 Halted 0 ms 0 KB -