QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#613590#8239. Mysterious Treeklhwong#TL 0ms0kbC++17669b2024-10-05 14:17:192024-10-05 14:18:08

Judging History

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

  • [2024-10-05 14:18:08]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-10-05 14:17:19]
  • 提交

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();  
    rep(i,1,n-1){
        printf("? %d %d\n", i , i+1);
        if(rd() == 0){
            puts("! 2");
            return;
        }
    }
    puts("! 1");
    return;
}

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

详细

Test #1:

score: 0
Time Limit Exceeded

input:

2
4

output:


result: