QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#613728#8239. Mysterious Treeklhwong#TL 0ms0kbC++17695b2024-10-05 14:35:462024-10-05 14:35:47

Judging History

你现在查看的是最新测评结果

  • [2024-10-05 14:35:47]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-10-05 14:35:46]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

inline int rd(){
    int x = 0;
    bool f = 0;
    char c = getchar();
    for(;!isdigit(c);c = getchar()) f |= ( c == '-' );
    for(;isdigit(c);c = getchar()) x = x * 10 + ( c ^ 48 );
    return f ? -x : x ;
}

#define rep(i,a,b) for(int i = (a); i<=(b);++i)
#define per(i,a,b) for(int i = (a); i>=(b);--i)
#define eb emplace_back

inline void work(){
    int n = rd();
    int limit = (n/2)+3;
    rep(i,1,limit){
        printf("? %d %d\n", i , i+1);
        if(rd() == 0){
            puts("! 2");
            return;
        }
    }
    puts("! 1");
    return;
}

int main(){
    per(i, rd(), 1) work(); 
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Time Limit Exceeded

input:

2
4

output:


result: