답안 #881037

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
881037 2023-11-30T11:46:34 Z abcvuitunggio 함박 스테이크 (JOI20_hamburg) C++17
6 / 100
80 ms 16320 KB
#include <bits/stdc++.h>
using namespace std;
const int INF=1e9;
int n,k,l[200001],d[200001],r[200001],u[200001];
vector <pair <int, int>> res;
vector <int> v;
vector <int> f(vector <int> v, int x, int y){
    vector <int> res;
    for (int i:v)
        if (l[i]>x||r[i]<x||d[i]>y||u[i]<y)
            res.push_back(i);
    return res;
}
bool solve(vector <int> v, int k){
    if (v.empty()){
        while (k--)
            res.push_back({1,1});
        return true;
    }
    if (!k)
        return false;
    int mn=INF,mn2=INF,mx2=0;
    for (int i:v){
        mn=min(mn,r[i]);
        mn2=min(mn2,u[i]);
        mx2=max(mx2,d[i]);
    }
    if (solve(f(v,mn,mn2),k-1)){
        res.push_back({mn,mn2});
        return true;
    }
    if (solve(f(v,mn,mx2),k-1)){
        res.push_back({mn,mx2});
        return true;
    }
    return false;
}
int main(){
    ios_base::sync_with_stdio(NULL);cin.tie(nullptr);
    cin >> n >> k;
    for (int i=0;i<n;i++){
        cin >> l[i] >> d[i] >> r[i] >> u[i];
        v.push_back(i);
    }
    bool tmp=solve(v,k);
    for (auto [x,y]:res)
        cout << x << ' ' << y << '\n';
}

Compilation message

hamburg.cpp: In function 'int main()':
hamburg.cpp:45:10: warning: unused variable 'tmp' [-Wunused-variable]
   45 |     bool tmp=solve(v,k);
      |          ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2600 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2648 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2656 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Correct 1 ms 2392 KB Output is correct
6 Correct 2 ms 2396 KB Output is correct
7 Correct 1 ms 2436 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Incorrect 1 ms 2652 KB Unexpected end of file - int32 expected
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 2 ms 2648 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 2 ms 2652 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Incorrect 1 ms 2652 KB Unexpected end of file - int32 expected
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 62 ms 10384 KB Output is correct
6 Correct 62 ms 10188 KB Output is correct
7 Correct 62 ms 10352 KB Output is correct
8 Correct 62 ms 10308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2600 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 63 ms 14284 KB Output is correct
6 Correct 80 ms 14320 KB Output is correct
7 Correct 64 ms 14396 KB Output is correct
8 Correct 70 ms 16320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2648 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2656 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Correct 1 ms 2392 KB Output is correct
6 Correct 2 ms 2396 KB Output is correct
7 Correct 1 ms 2436 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Incorrect 1 ms 2652 KB Unexpected end of file - int32 expected
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 2 ms 2648 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 2 ms 2652 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Incorrect 1 ms 2652 KB Unexpected end of file - int32 expected
10 Halted 0 ms 0 KB -