QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#110038 | #3553. Hamburg Steak | lmeowdn | Compile Error | / | / | C++ | 4.7kb | 2023-05-31 10:49:18 | 2023-05-31 10:49:20 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-05-31 10:49:20]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-05-31 10:49:18]
- 提交
answer
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define fi first
#define se second
#define eb emplace_back
#define popc __builtin_popcount
#define clz __builtin_clz
#define ctz __builtin_ctz
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;
typedef long double ld;
typedef unsigned long long ull;
typedef long long i64;
typedef __int128 i128;
int read() {
int x=0,w=1; char c=getchar();
while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();}
return x*w;
}
const int N=3e6+9;
int n,K,l[N],r[N],d[N],u[N],bx[N],by[N],cx,cy;
vp ans;
namespace Sol1 {
bool vst[N];
vi cov(int x,int y) {
vi tmp;
rep(i,1,n) if(!vst[i]) {
if(l[i]<=x&&x<=r[i]&&d[i]<=y&&y<=u[i])
tmp.eb(i);
}
return tmp;
}
void dfs(int pos,vp ps) {
if(pos==K+1) {
rep(i,1,n) if(!vst[i]) return;
ans=ps; return;
}
int maxl=0, minr=cx+1, maxd=0, minu=cy+1;
rep(i,1,n) if(!vst[i])
maxl=max(maxl,l[i]), minr=min(minr,r[i]),
maxd=max(maxd,d[i]), minu=min(minu,u[i]);
for(int x:{maxl,minr}) for(int y:{maxd,minu}) {
vi f=cov(x,y); for(int i:f) vst[i]=1;
vp q=ps; q.eb(x,y); dfs(pos+1,q);
if(ans.size()) return; for(int i:f) vst[i]=0;
}
}
void work() {vp tmp; dfs(1,tmp);}
}
namespace Sol2 {
int tot,pre[4][N][2],dfn[N],low[N],scc[N],cnt,in[N],st[N],top,pos[4],tick;
vi e[N];
void add(int x,int y) {if(x&&y) e[x].eb(y);}
void dfs(int u) {
dfn[u]=low[u]=++tick, st[++top]=u, in[u]=1;
for(int v:e[u])
if(!dfn[v]) dfs(v), low[u]=min(low[u],low[v]);
else if(in[v]) low[u]=min(low[u],dfn[v]);
if(dfn[u]==low[u]) {
++cnt; do {
int v=st[top]; scc[v]=cnt, in[v]=0;
} while(st[top--]!=u);
}
}
void work() {
int maxl=0, minr=cx+1, maxd=0, minu=cy+1;
rep(i,1,n)
maxl=max(maxl,l[i]), minr=min(minr,r[i]),
maxd=max(maxd,d[i]), minu=min(minu,u[i]);
int L=min(maxl,minr), R=max(maxl,minr);
int D=min(minu,maxd), U=max(minu,maxd);
rep(t,0,3) {
int x=(t<2?D:L), y=(t<2?U:R);
rep(i,x,y) rep(j,0,1) pre[t][i][j]=++tot;
rep(i,x+1,y) e[pre[t][i][0]].eb(pre[t][i-1][0]);
rep(i,x,y-1) e[pre[t][i][1]].eb(pre[t][i+1][1]);
}
rep(i,1,n) {
static int cov[4], x[4], y[4];
cov[0]=(l[i]<=L&&L<=r[i]), x[0]=d[i], y[0]=u[i];
cov[1]=(l[i]<=R&&R<=r[i]), x[1]=d[i], y[1]=u[i];
cov[2]=(d[i]<=D&&D<=u[i]), x[2]=l[i], y[2]=r[i];
cov[3]=(d[i]<=U&&U<=u[i]), x[3]=l[i], y[3]=r[i];
int sum=0; rep(i,0,3) sum+=cov[i];
if(sum==1) {
rep(t,0,3) if(cov[t]) {
add(pre[t][x[t]-1][1],pre[t][x[t]-1][0]);
add(pre[t][y[t]][0],pre[t][y[t]][1]);
}
} else if(sum==2) {
if(cov[0]&&cov[2])
add(pre[0][y[0]][0],pre[2][y[2]][1]),
add(pre[2][y[2]][0],pre[0][y[0]][1]);
else if(cov[0]&&cov[3])
add(pre[0][x[0]-1][1],pre[3][y[3]][1]),
add(pre[3][y[3]][0],pre[0][x[0]-1][0]);
else if(cov[1]&&cov[2])
add(pre[1][y[1]][0],pre[2][x[2]-1][0]),
add(pre[2][x[2]-1][1],pre[1][y[1]][1]);
else if(cov[1]&&cov[3])
add(pre[1][x[1]-1][1],pre[3][x[3]-1][0]),
add(pre[3][x[3]-1][1],pre[1][x[1]-1][0]);
else {
int p=cov[0]?0:2;
rep(t,p,p+1) {
add(pre[t][y[t]][0],pre[t^1][y[t^1]][1]),
add(pre[t][y[t]][0],pre[t^1][x[t^1]-1][0]),
add(pre[t][x[t^1]-1][1],pre[t^1][y[t^1]][1]),
add(pre[t][x[t^1]-1][1],pre[t^1][x[t^1]-1][0]);
}
}
}
}
rep(i,1,tot) if(!dfn[i]) dfs(i);
rep(t,0,3) {
int x=(t<2?D:L), y=(t<2?U:R);
rep(i,x,y)
if(scc[pre[t][i][1]]<scc[pre[t][i][0]])
{pos[t]=i; break;}
}
ans.eb(L,pos[0]), ans.eb(R,pos[1]);
ans.eb(pos[2],D), ans.eb(pos[3],U);
}
}
signed main() {
n=read(), K=read();
rep(i,1,n) l[i]=read(), d[i]=read(), r[i]=read(), u[i]=read();
rep(i,1,n) bx[++cx]=l[i], bx[++cx]=r[i];
rep(i,1,n) by[++cy]=d[i], by[++cy]=u[i];
sort(bx+1,bx+cx+1); cx=unique(bx+1,bx+cx+1)-bx-1;
sort(by+1,by+cy+1); cy=unique(by+1,by+cy+1)-by-1;
rep(i,1,n) l[i]=lower_bound(bx+1,bx+cx+1,l[i])-bx;
rep(i,1,n) r[i]=lower_bound(bx+1,bx+cx+1,r[i])-bx;
rep(i,1,n) d[i]=lower_bound(by+1,by+cy+1,d[i])-by;
rep(i,1,n) u[i]=lower_bound(by+1,by+cy+1,u[i])-by;
Sol1::work();
if(!ans.size()) Sol2::work();
for(auto [x,y]:ans) printf("%d %d\n",bx[x],by[y]);
checker();
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:147:3: error: ‘checker’ was not declared in this scope 147 | checker(); | ^~~~~~~