QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#371195#7804. Intersegment Activationkevinyang#RE 1ms3952kbC++171.5kb2024-03-30 01:46:112024-03-30 01:46:12

Judging History

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

  • [2024-03-30 01:46:12]
  • 评测
  • 测评结果:RE
  • 用时:1ms
  • 内存:3952kb
  • [2024-03-30 01:46:11]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
int query(pair<int,int>a){
    cout << a.first << ' ' << a.second << endl;
    int x;
    cin >> x;
    return x;
}
signed main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    int n;
    cin >> n;
    int k;
    cin >> k;
    if(k==n)return 0;
    vector<int>a;
    a.push_back(0);
    for(int i = 1; i<13; i++){
        vector<int>b;
        for(int nxt: a){
            b.push_back(nxt);
        }
        b.push_back(i);
        for(int nxt: a){
            b.push_back(nxt);
        }
        swap(a,b);
    }
    for(int i = 1; i<=n; i++){
        if(k==n)return 0;
        vector<pair<int,int>>vals;
        for(int j = i; j<=n; j++){
            vals.push_back({i,j});
        }
        int v = query(vals[a[0]]);
        if(v==n)return 0;
        if(v==k-1){
            int v3 = query(vals[a[0]]);
            if(v3==n){
                return 0;
            }
            continue;
        }
        int cur = 1;
        while(true){
            int v = query(vals[a[cur]]);
            if(v==n){
                return 0;
            }
            if(cur%2 == 0){
                if(v > k){
                    break;
                }
                if(v < k){
                    int v3 = query(vals[0]);
                    if(v3==n){
                        return 0;
                    }
                    break;
                }
            }
            k = v;
            cur++;
        }
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3720kb

input:

3
0
0
0
1
1
2
3

output:

1 1
1 2
1 1
2 2
2 3
2 2

result:

ok OK, 6 queries

Test #2:

score: 0
Accepted
time: 1ms
memory: 3892kb

input:

1
0
1

output:

1 1

result:

ok OK, 1 queries

Test #3:

score: 0
Accepted
time: 1ms
memory: 3720kb

input:

2
1
2

output:

1 1

result:

ok OK, 1 queries

Test #4:

score: 0
Accepted
time: 1ms
memory: 3952kb

input:

2
0
0
1
0
1
2

output:

1 1
1 2
1 1
1 1
2 2

result:

ok OK, 5 queries

Test #5:

score: -100
Runtime Error

input:

2
0
1
0
0

output:

1 1
1 2
1 1
0 49

result: