QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#821974#9804. Guess the Polygonwwww22WA 1ms5792kbC++201.1kb2024-12-19 20:00:312024-12-19 20:00:33

Judging History

This is the latest submission verdict.

  • [2024-12-19 20:00:33]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 5792kb
  • [2024-12-19 20:00:31]
  • Submitted

answer

#include<bits/stdc++.h>
#define ll long long
#define db long double
#define eb emplace_back
#define pi pair<ll,ll>
#define mk make_pair
#define fo(i,a,b) for(ll (i)=(a);(i)<=(b);(i)++)
#define fd(i,a,b) for(ll (i)=(a);(i)>=(b);(i)--)
using namespace std;
const int N=5e5+10;
int n;

struct node
{
	int x,y;
}a[N];

bool cmp(node a,node b)
{
	if(a.x!=b.x)
	{
		return a.x<b.x;
	}
	else
	{
		return a.y<b.y;
	}
}
db p,q;
db ask(int x)
{
	cout<<"? "<<x<<" "<<1<<endl;
	cin>>p>>q;
	return p/q;
}

db an[N];
db ans;

void solve(){
	cin>>n;
	ans=0;
	fo(i,1,n)
	{
		cin>>a[i].x>>a[i].y;
	}
	sort(a+1,a+1+n,cmp);
	an[1]=0;
	an[n]=0;
	fo(i,2,n-1)
	{
		an[i]=ask(a[i].x);
	}

	fo(i,2,n)
	{
		ans+=(a[i].x-a[i-1].x)*(an[i]+an[i-1]);
//		cout<<ans<<"\n";
	}
	
//	fo(i,1,n)
//	{
//		cout<<a[i].x<<" "<<a[i].y<<"\n";
//	}
	ll aaa=(ll)(ans+0.5);
	if(aaa%2)
	{
		cout<<"! "<<aaa<<" "<<2<<endl;
	}
	else
	{
		cout<<"! "<<aaa/2<<" "<<1<<endl;
	}
}
int main(){
//	ios::sync_with_stdio(false);
//	cin.tie(0),cout.tie(0);
	int T=1;
	cin>>T;
	while(T--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 5784kb

input:

2
4
3 0
1 3
1 1
0 0
2 1
2 1
3
0 0
999 1000
1000 999
1999 1000

output:

? 1 1
? 1 1
! 3 1
? 999 1
! 1999 2

result:

ok correct! (2 test cases)

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 5792kb

input:

9
4
1 1
1 3
3 0
0 0
3 1
3 1

output:

? 1 1
? 1 1
! 9 2

result:

wrong answer the answer is incorrect, expect: 5/2, find: 9/2 (test case 1)