QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#795860#9804. Guess the Polygonucup-team191#WA 1ms3872kbC++23840b2024-12-01 02:48:122024-12-01 02:48:14

Judging History

This is the latest submission verdict.

  • [2024-12-01 02:48:14]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3872kb
  • [2024-12-01 02:48:12]
  • Submitted

answer

#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
using pii=pair<int,int>;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
#define pb push_back
#define all(a) begin(a),end(a)

const int N=300010,MOD=1e9+7;
const char en='\n';
const ll LLINF=1ll<<60;

int t,n,tr;

pii qu(int a)
{
	cout<<"? "<<a<<' '<<1<<endl;
	int x,y;
	cin>>x>>y;
	return {x,y};
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin>>t;
	while (t--)
	{
		cin>>n;
		vi x;
		for (int i=0;i<n;++i)
		{
			int a;
			cin>>a>>tr;
			x.pb(a);
		}
		sort(all(x));
		double an=0;
		for (int i=1;i<n-1;++i)
		{
			pii re=qu(x[i]);
			an+=(x[i+1]-x[i-1])*1.*re.x/re.y;
		}
		ll aa=round(an);
		if (aa%2) cout<<"! "<<aa<<' '<<2<<endl;
		else cout<<"! "<<aa/2<<' '<<1<<endl;
	}
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3728kb

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: 0ms
memory: 3872kb

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)