# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
552059 | hoanghq2004 | Colors (BOI20_colors) | C++14 | 0 ms | 208 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 gen(std :: chrono :: system_clock :: now().time_since_epoch().count());
int main() {
ios :: sync_with_stdio(0); cin.tie(0);
int T;
cin >> T;
while (T--) {
long long n;
cin >> n;
long long minv = 0;
long long L = 1, R = n - 1;
long long cur = 0;
int sign = 1;
while (L <= R) {
long long mid = L + R >> 1;
cur += sign * mid;
minv = min(minv, cur);
sign *= -1;
L = mid + 1;
}
cur = 1 - minv;
sign = 1;
set <long long> s;
auto ask = [&](long long x) {
cout << "? " << x << endl;
s.insert(x);
string ans;
cin >> ans;
return (ans == "YES");
};
ask(cur);
L = 1, R = n - 1;
long long ans = n;
while (L <= R) {
long long mid = L + R >> 1;
cur += sign * mid;
sign *= -1;
if (ask(cur)) R = mid - 1, ans = min(ans, mid);
else L = mid + 1;
}
cout << "= " << ans << endl;
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |