QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#428621#7804. Intersegment ActivationJooDdaeRE 0ms0kbC++20811b2024-06-01 20:42:182024-06-01 20:42:19

Judging History

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

  • [2024-06-01 20:42:19]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-06-01 20:42:18]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int n, k;

vector<int> v;

void find(int u) {
    if(u == 0) {
        v.push_back(0);
        return;
    }

    find(u-1);
    v.push_back(u);
    find(u-1);
}

int query(int i, int j) {
    cout << i << " " << j << endl;
    int re; cin >> re;
    return re;
}

int main() {
    find(9);

    cin.tie(0)->sync_with_stdio(0);
    cin >> n >> k;

    for(int i=n;i>=1;i--) {
        auto x = query(i, i);

        if(x < k) {
            query(i, i);
            continue;
        }

        if(x == k) {
            int u = 0;
            while(1) {
                auto y = query(i, i+v[u++]);
                if(y > k) break;
            }
        }

        if(++k == n) return 0;
    }
}

详细

Test #1:

score: 0
Runtime Error

input:

3
0
0
0

output:

3 3
3 3
3 4

result: