# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
289823 | 2020-09-03T06:17:01 Z | 문홍윤(#5788) | 함박 스테이크 (JOI20_hamburg) | C++17 | 3000 ms | 3492 KB |
#include <bits/stdc++.h> #define eb emplace_back #define mp make_pair #define F first #define S second 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]; 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); while(1){ random_shuffle(rct+1, rct+n+1); for(int i=1; i<=k; i++)ans[i]=mp(mp(1, 1), mp(inf, inf)); bool flg=true; for(int i=1; i<=n; i++){ 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)flg=false; } if(flg)break; } for(int i=1; i<=k; i++)printf("%d %d\n", ans[i].F.F, ans[i].F.S); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 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 | 7 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 8 ms | 384 KB | Output is correct |
9 | Correct | 12 ms | 384 KB | Output is correct |
10 | Correct | 140 ms | 384 KB | Output is correct |
11 | Correct | 37 ms | 384 KB | Output is correct |
12 | Correct | 18 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 14 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 428 ms | 392 KB | Output is correct |
8 | Correct | 106 ms | 384 KB | Output is correct |
9 | Correct | 400 ms | 504 KB | Output is correct |
10 | Correct | 56 ms | 384 KB | Output is correct |
11 | Correct | 477 ms | 504 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 2555 ms | 400 KB | Output is correct |
14 | Correct | 2347 ms | 392 KB | Output is correct |
15 | Correct | 199 ms | 392 KB | Output is correct |
16 | Correct | 129 ms | 384 KB | Output is correct |
17 | Correct | 213 ms | 400 KB | Output is correct |
18 | Correct | 450 ms | 384 KB | Output is correct |
19 | Correct | 38 ms | 384 KB | Output is correct |
20 | Execution timed out | 3023 ms | 384 KB | Time limit exceeded |
21 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | 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 | 147 ms | 3448 KB | Output is correct |
6 | Correct | 171 ms | 3448 KB | Output is correct |
7 | Correct | 138 ms | 3448 KB | Output is correct |
8 | Correct | 151 ms | 3448 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 350 ms | 3448 KB | Output is correct |
6 | Execution timed out | 3067 ms | 3384 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 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 | 7 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 8 ms | 384 KB | Output is correct |
9 | Correct | 12 ms | 384 KB | Output is correct |
10 | Correct | 140 ms | 384 KB | Output is correct |
11 | Correct | 37 ms | 384 KB | Output is correct |
12 | Correct | 18 ms | 384 KB | Output is correct |
13 | Correct | 261 ms | 3492 KB | Output is correct |
14 | Correct | 1517 ms | 3492 KB | Output is correct |
15 | Execution timed out | 3046 ms | 3448 KB | Time limit exceeded |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 14 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 428 ms | 392 KB | Output is correct |
8 | Correct | 106 ms | 384 KB | Output is correct |
9 | Correct | 400 ms | 504 KB | Output is correct |
10 | Correct | 56 ms | 384 KB | Output is correct |
11 | Correct | 477 ms | 504 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 2555 ms | 400 KB | Output is correct |
14 | Correct | 2347 ms | 392 KB | Output is correct |
15 | Correct | 199 ms | 392 KB | Output is correct |
16 | Correct | 129 ms | 384 KB | Output is correct |
17 | Correct | 213 ms | 400 KB | Output is correct |
18 | Correct | 450 ms | 384 KB | Output is correct |
19 | Correct | 38 ms | 384 KB | Output is correct |
20 | Execution timed out | 3023 ms | 384 KB | Time limit exceeded |
21 | Halted | 0 ms | 0 KB | - |