QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#131867#5134. Jagged SkylineYarema#WA 1ms3500kbC++171013b2023-07-28 17:13:032023-07-28 17:13:06

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-28 17:13:06]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3500kb
  • [2023-07-28 17:13:03]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define FILL(a, b) memset(a, b, sizeof(a))

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;

const int INF = 1e9;

int main()
{
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	
	LL w, h;
	cin >> w >> h;
	int b = -1;
	LL bst = 0;
	string s;
	FOR (i, 0, w)
	{
		cout << "? " << i + 1 << ' ' << bst + 1 << endl;
		cin >> s;
		if (s == "sky") continue;
		LL l = bst + 1, r = h + 1;
		while (l + 1 < r)
		{
			LL m = (l + r) / 2;
			cout << "? " << i + 1 << ' ' << m << endl;
			cin >> s;
			if (s == "sky")
				r = m;
			else
				l = m;
		}
		bst = l;
		b = i + 1;
		if (bst == h) break;
	}
	cout << "! " << b << ' ' << bst << endl;
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3500kb

input:

1 1
sky

output:

? 1 1
! -1 0

result:

wrong answer Integer parameter [name=xans] equals to -1, violates the range [1, 1]