답안 #289825

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
289825 2020-09-03T06:19:55 Z 문홍윤(#5788) 함박 스테이크 (JOI20_hamburg) C++17
3 / 100
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;
            int st=rand()%k+1;
            for(int j=st; j<st+k; j++){
                int sx=max(rct[i].F.F, ans[j%k+1].F.F);
                int sy=max(rct[i].F.S, ans[j%k+1].F.S);
                int ex=min(rct[i].S.F, ans[j%k+1].S.F);
                int ey=min(rct[i].S.S, ans[j%k+1].S.S);
                if(sx<=ex&&sy<=ey){
                    ans[j%k+1]=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

hamburg.cpp: In function 'int main()':
hamburg.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |     scanf("%d %d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~
hamburg.cpp:17:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |     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 29 ms 384 KB Output is correct
2 Correct 33 ms 384 KB Output is correct
3 Correct 34 ms 384 KB Output is correct
4 Correct 13 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 789 ms 504 KB Output is correct
2 Correct 240 ms 392 KB Output is correct
3 Correct 2430 ms 392 KB Output is correct
4 Correct 34 ms 384 KB Output is correct
5 Correct 29 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 189 ms 384 KB Output is correct
8 Correct 29 ms 384 KB Output is correct
9 Correct 354 ms 396 KB Output is correct
10 Correct 2722 ms 392 KB Output is correct
11 Correct 395 ms 504 KB Output is correct
12 Execution timed out 3045 ms 384 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Correct 478 ms 396 KB Output is correct
2 Correct 57 ms 384 KB Output is correct
3 Execution timed out 3088 ms 384 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 3492 KB Output is correct
6 Correct 152 ms 3380 KB Output is correct
7 Correct 143 ms 3448 KB Output is correct
8 Correct 148 ms 3448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 384 KB Output is correct
2 Correct 33 ms 384 KB Output is correct
3 Correct 34 ms 384 KB Output is correct
4 Correct 13 ms 384 KB Output is correct
5 Correct 602 ms 3488 KB Output is correct
6 Execution timed out 3068 ms 3452 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 789 ms 504 KB Output is correct
2 Correct 240 ms 392 KB Output is correct
3 Correct 2430 ms 392 KB Output is correct
4 Correct 34 ms 384 KB Output is correct
5 Correct 29 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 189 ms 384 KB Output is correct
8 Correct 29 ms 384 KB Output is correct
9 Correct 354 ms 396 KB Output is correct
10 Correct 2722 ms 392 KB Output is correct
11 Correct 395 ms 504 KB Output is correct
12 Execution timed out 3045 ms 384 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Correct 478 ms 396 KB Output is correct
2 Correct 57 ms 384 KB Output is correct
3 Execution timed out 3088 ms 384 KB Time limit exceeded
4 Halted 0 ms 0 KB -