Submission #1038873

# Submission time Handle Problem Language Result Execution time Memory
1038873 2024-07-30T08:34:26 Z hotboy2703 Hamburg Steak (JOI20_hamburg) C++17
0 / 100
1 ms 604 KB
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
#define pll pair <ll,ll>
#define fi first
#define se second
#define MP make_pair
#define sz(a) (ll((a).size()))
#define BIT(mask,i) (((mask) >> (i))&1)
#define MASK(i) (1LL << (i))
const ll INF = 1e18;
struct rec{
    ll l,r,d,u;
    rec(ll l1= 0,ll r1 = 0,ll d1 = 0,ll u1 = 0):l(l1),r(r1),d(d1),u(u1){}
};
namespace SCC{

}
vector <rec> A;
ll n,k;
vector <pll> ans;
bool done = 0;
vector <rec> del(vector <rec> a,pll y){
    vector <rec> res;
    for (auto x:a){
        if (x.l <= y.fi && x.r >= y.fi &&
            x.d <= y.se && x.u >= y.se){}
        else res.emplace_back(x);
    }
    return res;
}
void brute(vector <rec> cur,vector <pll> c){
    if (done)return;
    // for (auto x:cur)cout<<x.l<<' '<<x.r<<' '<<x.d<<' '<<x.u<<' ';
    // cout<<sz(c)<<'\n';
    if (sz(c)==k||cur.empty()){
        while (sz(c) < k){c.push_back(MP(0,0));}
        if (cur.empty()){
            // for (ll i = 0;i < k;i ++)cout<<c[i].fi<<' '<<c[i].se<<'\n';
            done = 1;
        }
        return;
    }
    ll L=0,R=INF,D=0,U=INF;
    for (auto x:cur){
        L = max(x.l,L);
        R = min(x.r,R);
        D = max(x.d,D);
        U = min(x.u,U);
    }
    {
        auto tmp = MP(L,D);
        c.push_back(tmp);
        brute(del(cur,tmp),c);
        c.pop_back();
    }
    {
        auto tmp = MP(L,U);
        c.push_back(tmp);
        brute(del(cur,tmp),c);
        c.pop_back();
    }
    {
        auto tmp = MP(R,D);
        c.push_back(tmp);
        brute(del(cur,tmp),c);
        c.pop_back();
    }
    {
        auto tmp = MP(R,U);
        c.push_back(tmp);
        brute(del(cur,tmp),c);
        c.pop_back();
    }
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(nullptr);
    cin>>n>>k;
    A.resize(n);
    for (auto &x:A)cin>>x.l>>x.d>>x.r>>x.u;
    brute(A,ans);
    if (done)return 0;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 604 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 604 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 604 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 596 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 604 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 604 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 604 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 596 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -