QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#336621 | #2199. Intriguing Selection | Milan | WA | 0ms | 3612kb | C++23 | 1.4kb | 2024-02-24 18:26:38 | 2024-02-24 18:26:39 |
Judging History
answer
#include <bits/stdc++.h>
#define MULTI int _; cin >> _; while(_--)
#define fi first
#define se second
#define pb(a) push_back(a)
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, n, m) for(int i = n; i <= m; i++)
#define repsv(i, n, m) for(int i = n; i >= m; i--)
#define vsz(a) (int)(a.size())
#define mp(a, b) make_pair(a, b)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<double, double> pdd;
typedef pair<int, int> pii;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
#ifdef LOCAL
#include "debugs.hpp"
#else
#define dbg(...) 0
#endif
int n;
vi a;
bool ask(int x, int y){
cout << "? " << x << ' ' << y << '\n';
char in;
cin >> in;
return in == '<';
}
int cmp(int l, int r){
if(l==r) return a[l];
else{
int m = (l+r)/2;
int v1 = cmp(l, m);
int v2 = cmp(m+1, r);
if(v1 != -1) swap(v1, v2);
if(v1 == -1 && v2 == -1)
return -1;
if(v1 == -1)
return v2;
if(ask(v1, v2))
return v1;
else
return v2;
}
}
void solve(){
cin >> n;
n *= 2;
a = vi(n);
rep(i, n) a[i] = i+1;
rep(i, n/2){
int noob = cmp(0, n-1);
a[noob-1] = -1;
}
cout << "!\n";
}
int main(){
ios_base::sync_with_stdio(false);
MULTI
solve();
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3612kb
input:
2 3 < < < < < < < < < < < < 3 > > < > > < < > < < > >
output:
? 2 1 ? 3 2 ? 5 4 ? 6 5 ? 6 3 ? 2 1 ? 3 2 ? 5 4 ? 5 3 ? 2 1 ? 3 2 ? 4 3 ! ? 2 1 ? 3 1 ? 5 4 ? 6 5 ? 5 1 ? 3 2 ? 5 4 ? 6 5 ? 5 3 ? 3 2 ? 6 4 ? 4 3 !
result:
wrong answer Case 0: all players in topn are comparable