Submission #1291413

#TimeUsernameProblemLanguageResultExecution timeMemory
12914131otaToxic Gene (NOI23_toxic)C++20
0 / 100
0 ms332 KiB
#include "toxic.h"
#include <bits/stdc++.h>
using namespace std;

// int query_sample(vector<int> species){
//     for (auto b : species) cout << b << " ";
//     int res; cin >> res;
//     return res;
// }

// void answer_type (int x, char c){
//     cout << "! " << x << " " << c << " ";
// }

void determine_type(int n){
    auto query = [&](vector<int> species){
        for (auto& i : species) i++;
        return query_sample(species);
    };

    auto answer = [&](int x, char c){
        answer_type(x+1, c);
    };

    vector<bool> vis(n, false);

    int tidx = -1;
    for (int i = 0; i < n; i++){
        int strong = query(vector<int>{i});
        if (strong == 0) tidx = i, vis[i] = false, answer(i, 'T');
    }

    for (int i = 0; i < n; i++){
        if (vis[i]) continue;
        int strong = query(vector<int>{i, tidx});
        if (strong == 0) answer(i, 'R');
        else answer(i, 'S');
    }

}

// int32_t main(){
//     determine_type(5);
//     return 0;
// }
#Verdict Execution timeMemoryGrader output
Fetching results...