QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#607864 | #3873. Towers | panyifan2021 | Compile Error | / | / | C++14 | 1.3kb | 2024-10-03 16:47:40 | 2024-10-03 16:47:41 |
Judging History
This is the latest submission verdict.
- [2024-10-03 16:47:41]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-10-03 16:47:40]
- Submitted
answer
#include <bits/stdc++.h>
using namespace std;
int n;
int ex[1000005],ey[1000005];
vector<int> col[1000005],t;
int l[1000005],r[1000005];
set<int> row[1000005];
bool ans[1000005];
queue<int> q;
void add(int x){
ans[x]=1;
row[ex[x]].insert(ey[x]);
if(row[ex[x]].size()>2)
q.push(ex[x]);
}
void del(int x){
ans[x]=0;
row[ex[x]].erase(ey[x]);
}
int main(){
cin>>n;
int mx=0;
for(int i=1;i<=n;i++){
cin>>ex[i]>>ey[i];
col[ey[i]].push_back(i);
mx=max(mx,ey[i])
}
for(int i=1;i<=mx;i++){
if(!col[i].size()) continue;
sort(col[i].begin(),col[i].end(),[](int i,int j){return ex[i]<ex[j];});
l[i]=0;
r[i]=col[i].size()-1;
add(col[i][l[i]]);
if(l[i]!=r[i])
add(col[i][r[i]]);
}
while(q.size()){
int x=q.front();
q.pop();
if(row[x].size()<=2) continue;
int ly=*row[x].begin(),ry=*--row[x].end();
t.clear();
for(int y:row[x]) if(y!=ly&&y!=ry) t.push_back(y);
for(int y:t){
if(y==ly||y==ry) continue;
if(l[y]>r[y]) continue;
if(l[y]==r[y]) del(col[y][l[y]++]);
else if(x==ex[col[y][l[y]]]){
del(col[y][l[y]++]);
if(l[y]<r[y]) add(col[y][l[y]]);
}
else{
del(col[y][r[y]--]);
if(l[y]<r[y]) add(col[y][r[y]]);
}
}
}
for(int i=1;i<=n;i++)
cout<<ans[i];
return 0;
}
詳細信息
answer.code: In function ‘int main()’: answer.code:26:33: error: expected ‘;’ before ‘}’ token 26 | mx=max(mx,ey[i]) | ^ | ; 27 | } | ~