QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#736687 | #5134. Jagged Skyline | nicksms# | WA | 1ms | 3616kb | C++17 | 1.1kb | 2024-11-12 12:34:43 | 2024-11-12 12:34:44 |
Judging History
answer
/**
* Author: Nicholas Winschel
* Created: 11.11.2024 23:26:54
**/
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using db=long double;
template<class T> using V=vector<T>;
using vi = V<int>;
using vl = V<ll>;
using pi = pair<int,int>;
#define f first
#define s second
#define sz(x) (int)((x).size())
#define each(a,b) for (auto &a : b)
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int main() {
cin.tie(0)->sync_with_stdio(0); // initialize fast I/O
int w; ll h; cin >> w >> h;
vi z(w);
iota(z.begin(), z.end(), 1);
shuffle(z.begin(), z.end(), rng);
ll ci = 0, ch = 0;
for (int i : z) {
if (ch == h) continue;
cout << "? " << i << " " << ch+1 << endl;
string s; cin >> s;
if (s == "building") {
ll l = ch+1, r=h+1;
while (r-l > 1) {
ll m = (l+r)>>1;
cout << "? " << i << " " << m << endl;
cin >> s;
if (s == "sky") {
r = m;
} else {
l = m;
}
}
ci = i;
ch = l;
}
}
cout << "! " << ci << " " << ch << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3616kb
input:
1 1 sky
output:
? 1 1 ! 0 0
result:
wrong answer Integer parameter [name=xans] equals to 0, violates the range [1, 1]