제출 #1291412

#제출 시각아이디문제언어결과실행 시간메모리
12914121otaToxic Gene (NOI23_toxic)C++20
컴파일 에러
0 ms0 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;
// }

컴파일 시 표준 에러 (stderr) 메시지

toxic.cpp: In lambda function:
toxic.cpp:18:16: error: 'query_sample' was not declared in this scope
   18 |         return query_sample(species);
      |                ^~~~~~~~~~~~
toxic.cpp: In lambda function:
toxic.cpp:22:9: error: 'answer_type' was not declared in this scope
   22 |         answer_type(x+1, c);
      |         ^~~~~~~~~~~