QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#607687#8939. Permutationxing4cWA 1ms3628kbC++172.0kb2024-10-03 15:48:342024-10-03 15:48:34

Judging History

This is the latest submission verdict.

  • [2024-10-03 15:48:34]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3628kb
  • [2024-10-03 15:48:34]
  • Submitted

answer

#pragma G++ optimize("O2")
#include<iostream>
#include<cstdio>
#include<vector>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<map>
#include<cmath>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pll = pair<ll, ll>;
#define RI register int
#define int long long
#define fi first
#define se second
#define pb push_back
#define endl '\n'
#define For(i,a,b) for(RI(i)=(int)(a);(i)<=(int)(b);++(i))
#define Ford(i,a,b) for(RI(i)=(int)(a);(i)>=(int)(b);--(i))
template<class T>using _pq = priority_queue<T, vector<T>, greater<T> >;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
bool check2(int x) { return x > 0 ? (x & (x - 1)) == 0 : false; }//2的幂
const ld PI = 3.1415926535897932384626;
const double EXP = 1e-8;
const ll N = 1e5 + 7, INF = 0x3f3f3f3f3f3f3f3f;
int m, n, x, y, z,s, c1, a1,t, mod = 1e9 + 7, sum;
//int b[N],a[N],c[N];
//<int>e[N];
//void add(int a,int b){e[a].pb(b);e[b].pb(a);}
//void dfs(int u,int f) { for (auto v : e[u]) { if(f==v)continue;dfs(v); } }
int q(int l, int r) {
    cout << "?" << ' ' << l <<' ' <<r<<endl;
    cout.flush();
    cin >> a1; return a1;
}
int work(int l, int r,int s) {
    if (l == r)return  l;
    if (s == 0)s=q(l, r);
    x = r - l + 1;
    if (x == 2) {
        if (s == l)z = r; else z =l; return z;
    }
    y = (x + 1)/ 3;
    if (2 * s <= (l + r)) {
        if (q(l, r - y) == s)work(l, r - y, s);
        else work(r - y + 1, r, 0);
    }
    else {
        if (q(l+y, r ) == s)work(l+y, r, s);
        else work(l, l+y-1, 0);
    }

}
void solve() {
    cin >> n ;
    //z = work(1, n, 0);
    cout << '!' <<' '<<1+t<< endl; cout.flush();
}

signed main() {
   // ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    //int t = 1;
    cin>>t;
    while (t--)solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
5

output:

! 3

result:

wrong answer Wrong prediction (test case 1)