QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#812496#9804. Guess the Polygonrotcar07WA 1ms3676kbC++23614b2024-12-13 16:17:302024-12-13 16:17:31

Judging History

This is the latest submission verdict.

  • [2024-12-13 16:17:31]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3676kb
  • [2024-12-13 16:17:30]
  • Submitted

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();
}

Details

Tip: Click on the bar to expand more detailed information

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)