#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 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
852 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
604 KB |
Output is correct |
2 |
Correct |
1 ms |
608 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
604 KB |
Output is correct |
2 |
Correct |
1 ms |
720 KB |
Output is correct |
3 |
Correct |
1 ms |
860 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
860 KB |
Output is correct |
8 |
Correct |
2 ms |
1004 KB |
Output is correct |
9 |
Correct |
1 ms |
856 KB |
Output is correct |
10 |
Correct |
2 ms |
1064 KB |
Output is correct |
11 |
Correct |
1 ms |
860 KB |
Output is correct |
12 |
Correct |
1 ms |
860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
5 |
Correct |
2 ms |
720 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
860 KB |
Output is correct |
8 |
Correct |
4 ms |
1196 KB |
Output is correct |
9 |
Correct |
1 ms |
860 KB |
Output is correct |
10 |
Correct |
3 ms |
1112 KB |
Output is correct |
11 |
Correct |
5 ms |
1112 KB |
Output is correct |
12 |
Correct |
2 ms |
860 KB |
Output is correct |
13 |
Correct |
1 ms |
860 KB |
Output is correct |
14 |
Incorrect |
4 ms |
1100 KB |
Unexpected end of file - int32 expected |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
852 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
5 |
Correct |
57 ms |
23276 KB |
Output is correct |
6 |
Correct |
58 ms |
23232 KB |
Output is correct |
7 |
Correct |
57 ms |
23268 KB |
Output is correct |
8 |
Correct |
58 ms |
23292 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
604 KB |
Output is correct |
2 |
Correct |
1 ms |
608 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
860 KB |
Output is correct |
5 |
Correct |
70 ms |
36540 KB |
Output is correct |
6 |
Correct |
73 ms |
37784 KB |
Output is correct |
7 |
Correct |
72 ms |
30536 KB |
Output is correct |
8 |
Correct |
80 ms |
46164 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
604 KB |
Output is correct |
2 |
Correct |
1 ms |
720 KB |
Output is correct |
3 |
Correct |
1 ms |
860 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
860 KB |
Output is correct |
8 |
Correct |
2 ms |
1004 KB |
Output is correct |
9 |
Correct |
1 ms |
856 KB |
Output is correct |
10 |
Correct |
2 ms |
1064 KB |
Output is correct |
11 |
Correct |
1 ms |
860 KB |
Output is correct |
12 |
Correct |
1 ms |
860 KB |
Output is correct |
13 |
Correct |
78 ms |
36808 KB |
Output is correct |
14 |
Correct |
83 ms |
38276 KB |
Output is correct |
15 |
Correct |
76 ms |
38188 KB |
Output is correct |
16 |
Correct |
71 ms |
34248 KB |
Output is correct |
17 |
Correct |
80 ms |
37624 KB |
Output is correct |
18 |
Correct |
77 ms |
31444 KB |
Output is correct |
19 |
Correct |
86 ms |
42236 KB |
Output is correct |
20 |
Correct |
224 ms |
63480 KB |
Output is correct |
21 |
Correct |
91 ms |
45004 KB |
Output is correct |
22 |
Correct |
112 ms |
63304 KB |
Output is correct |
23 |
Correct |
141 ms |
62124 KB |
Output is correct |
24 |
Correct |
125 ms |
58912 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
5 |
Correct |
2 ms |
720 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
860 KB |
Output is correct |
8 |
Correct |
4 ms |
1196 KB |
Output is correct |
9 |
Correct |
1 ms |
860 KB |
Output is correct |
10 |
Correct |
3 ms |
1112 KB |
Output is correct |
11 |
Correct |
5 ms |
1112 KB |
Output is correct |
12 |
Correct |
2 ms |
860 KB |
Output is correct |
13 |
Correct |
1 ms |
860 KB |
Output is correct |
14 |
Incorrect |
4 ms |
1100 KB |
Unexpected end of file - int32 expected |
15 |
Halted |
0 ms |
0 KB |
- |