QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#584226 | #8270. Mineral deposits | hansiyuan | 0 | 1ms | 3944kb | C++14 | 1.9kb | 2024-09-23 10:32:49 | 2024-09-23 10:32:53 |
answer
#include <bits/stdc++.h>
#define pii pair<int,int>
#define X first
#define Y second
using namespace std;
const int bor = 1e8;
int b,k,w,d;
int D[100];
set<pii> ta;
vector<pii> a;
set<int> s,key;
vector<pii> ques;
multiset<int> res;
int dis[405];
int Dis(pii u,pii v){
return abs(u.X-v.X)+abs(u.Y-v.Y);
}
bool chk(int i,int dx,int dy){
pii u = a[i];
pii p = {u.X+dx,u.Y+dy};
int dt = Dis(u,p);
if(p.X < -bor || p.X > bor || p.Y < -bor || p.Y > bor) return false;
for(int j=i+1;j<a.size();j++){
pii v = a[j];
if(key.count(Dis(v,p)) || Dis(v,p)==dt) return false;
}
printf("%d %d\n",p.X,p.Y);
key.insert(dt);
for(int i=0;i<a.size();i++)
s.insert(Dis(a[i],p));
ques.push_back(p);
return true;
}
int main(){
scanf("%d%d%d",&b,&k,&w);
printf("? %d %d %d %d\n",-b,-b,-b,b);
fflush(stdout);
for(int i=1;i<=k*2;i++)
scanf("%d",&D[i]);
for(int i=1;i<=k*2;i++)
for(int j=1;j<=k*2;j++){
ta.insert({(D[i]+D[j])/2-b*2,(D[i]-D[j])/2});
}
while(ta.size()){
pii p = *ta.begin();
ta.erase(p);
a.push_back(p);
printf("%d %d\n",p.X,p.Y);
}
for(int i=0;i<a.size();i++){
pii p = a[i];
while(!chk(i,-d,0) && !chk(i,d,0) && !chk(i,0,-d) && !chk(i,0,d)) d++;
dis[i] = d;
while(s.count(d)) d++;
}
printf("? ");
for(pii p:ques) printf("%d %d ",p.X,p.Y);
puts(""); fflush(stdout);
for(int i=1;i<=ques.size()*k;i++){
int x; scanf("%d",&x);
res.insert(x);
}
printf("! ");
for(int i=0;i<a.size();i++){
pii u = a[i];
if(res.find(dis[i])!=res.end()){
printf("%d %d ",u.X,u.Y);
for(pii q:ques){
res.erase(Dis(u,q));
}
}
}
fflush(stdout);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3944kb
input:
10 1 10000 20 30
output:
? -10 -10 -10 10 0 0 5 -5 5 5 10 0 0 0 4 -5 3 5 7 0 ? 0 0 4 -5 3 5 7 0
result:
wrong answer unknown command 0
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Runtime Error
Test #116:
score: 0
Runtime Error
input:
100 20 3 64 75 90 91 93 99 113 132 136 152 158 162 166 174 177 179 188 189 190 197 197 200 202 205 214 225 226 227 229 229 242 254 261 268 270 277 283 314 327 335
output:
? -100 -100 -100 100 -136 0 -131 -5 -131 5 -125 0 -123 -13 -123 13 -122 -14 -122 14 -119 -17 -119 17 -118 -7 -118 7 -117 -8 -117 8 -116 -9 -116 9 -113 -12 -113 12 -112 -24 -112 24 -110 0 -109 -1 -109 0 -109 1 -108 -1 -108 1 -107 0 -106 -19 -106 -4 -106 4 -106 19 -105 -4 -105 4 -104 -3 -104 3 -102 -3...
result:
Subtask #6:
score: 0
Skipped
Dependency #5:
0%
Subtask #7:
score: 0
Skipped
Dependency #1:
0%