QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#117320 | #4778. Tracking RFIDs | momoyuu | Compile Error | / | / | C++17 | 2.7kb | 2023-06-30 23:20:17 | 2023-06-30 23:20: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-06-30 23:20:20]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-06-30 23:20:17]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll ccw(pair<ll,ll> a,pair<ll,ll> b,pair<ll,ll> c){
ll na = b.first - a.first;
ll nb = b.second - a.second;
ll ma = c.first - a.first;
ll mb = c.second - a.second;
if(na*mb-nb*ma>0) return 1;
if(na*mb-nb*ma<0) return -1;
if(na*ma+nb*mb<0) return 2;
if(na*na+nb*nb<ma*ma+mb*mb) return -2;
return 0;
}
bool ch(ll x1,ll y1,ll x2,ll y2,ll x3,ll y3,ll x4,ll y4){
ll tc = (x1-x2)*(y3-y1) + (y1-y2)*(x1-x3);
ll td = (x1-x2)*(y4-y1) + (y1-y2)*(x1-x4);
return tc*td<0;
}
void solve(){
ll s,r,w,p;
cin>>s>>r>>w>>p;
ll mask = 10040 + 100;
vector<set<ll>> d(30000);
for(int i = 0;i<s;i++){
ll x,y;
cin>>x>>y;
d[x+mask].insert(y);
}
vector<ll> bx(w),by(w),ex(w),ey(w);
for(int i = 0;i<w;i++) cin>>bx[i]>>by[i]>>ex[i]>>ey[i];
for(int i = 0;i<p;i++){
set<pair<ll,ll>> ans;
ll px,py;
cin>>px>>py;
for(ll xx = px - r;xx <= px + r;xx++){
ll nx = xx + mask;
auto itr = d[nx].lower_bound(py-r);
while(itr!=d[nx].end()){
pair<ll,ll> now = make_pair(xx,*itr);
ll dx = px - now.first;
ll dy = py - now.second;
if(dx*dx+dy*dy>r*r) break;
if(px==xx&&py==*itr){
ans.insert(now);
itr++;
continue;
}
int cnt = 0;
for(int j = 0;j<w;j++){
if(ch(px,py,now.first,now.second,bx[j],by[j],exj[j],ey[j])) cnt++;
//if(ch(make_pair(px,py),make_pair(bx[j],by[j]),now)) continue;
//if(ch(make_pair(px,py),make_pair(ex[j],ey[j]),now)) continue;
//if(ch(make_pair(px,py),make_pair(bx[j],by[j]),make_pair(ex[j],ey[j]))&&ch(now,make_pair(bx[j],by[j]),make_pair(ex[j],ey[j]))) continue;
//if(ccw(make_pair(px,py),now,make_pair(bx[j],by[j]))*ccw(make_pair(px,py),now,make_pair(ex[j],ey[j]))<=0&&ccw(make_pair(bx[j],by[j]),make_pair(ex[j],ey[j]),make_pair(px,py))*ccw(make_pair(bx[j],by[j]),make_pair(ex[j],ey[j]),now)<=0) cnt++;
}
//cout<<cnt<<" "<<xx<<" "<<*itr<<endl;
if(r-cnt>=0&&dx*dx+dy*dy<=(r-cnt)*(r-cnt)) ans.insert(now);
itr++;
}
}
cout<<ans.size();
for(auto&itr:ans) cout<<" ("<<itr.first<<","<<itr.second<<")";
cout<<endl;
}
}
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int t;
cin>>t;
while(t--){
solve();
}
}
Details
answer.code: In function ‘void solve()’: answer.code:55:46: error: ‘exj’ was not declared in this scope; did you mean ‘ex’? 55 | if(ch(px,py,now.first,now.second,bx[j],by[j],exj[j],ey[j])) cnt++; | ^~~ | ex