QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#812496 | #9804. Guess the Polygon | rotcar07 | WA | 1ms | 3676kb | C++23 | 614b | 2024-12-13 16:17:30 | 2024-12-13 16:17:31 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
ld q(int x,int y){cout<<"? "<<x<<' '<<y<<endl;ld r,s;cin>>r>>s;return r/s;}
inline void solve(){
int n;cin>>n;
vector<int> v;for(int i=1,x,w;i<=n;i++) cin>>x>>w,v.push_back(x);
sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end());
ld res=0;
if(v.size()<n)for(int i=0;i+1<v.size();i++) res+=(v[i+1]-v[i])*q(v[i]+v[i+1],2);
else for(int i=1;i+1<v.size();i++) res+=(v[i+1]-v[i-1])*q(v[i],1);
int w=llround(res);
cout<<"! "<<(w&1?w:w>>1)<<' '<<2-(w&1)<<endl;
}
int main(){
int T;cin>>T;
while(T--) solve();
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3676kb
input:
2 4 3 0 1 3 1 1 0 0 1 1 1 1 3 0 0 999 1000 1000 999 1999 1000
output:
? 1 2 ? 4 2 ! 3 1 ? 999 1 ! 1999 1
result:
wrong answer the answer is incorrect, expect: 1999/2, find: 1999/1 (test case 2)