QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#858054 | #8939. Permutation | luuia | WA | 0ms | 3584kb | C++14 | 595b | 2025-01-16 13:39:34 | 2025-01-16 13:39:35 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 + 10;
const double t = 0.618;
ll T,n,m,o,s,l,r,L,R;
ll query(ll l,ll r)
{
ll o;cout << "? " << l << " " << r << '\n';
cin >> o;return o;
}
void cal(ll l,ll r,ll x)
{
if(l == r){cout << l << '\n';return;}
ll mid = t * l + (1 - t) * r;
ll o = query(l,mid);
if(o == x) {cal(l,mid,o);return;}
ll p = query(mid + 1,r);cal(mid + 1,r,p);
}
void sol(){cin >> n,s = query(1,n),cal(1,n,s);}
int main()
{
// freopen("input.in","r",stdin);
cin >> T;while(T--) sol();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3584kb
input:
3 5 3 1 3
output:
? 1 5 ? 1 2 ? 3 5 ? 3 3
result:
wrong answer Integer 3 violates the range [4, 5] (test case 1)