답안 #1117042

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1117042 2024-11-22T19:17:45 Z gustavo_d CEOI16_icc (CEOI16_icc) C++17
컴파일 오류
0 ms 0 KB
// #include "icc.h"
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 100;
vector<int> adj[MAXN+1];
bool vis[MAXN+1];

void dfs(int v) {
    vis[v] = true;
    for (int viz : adj[v]) {
        if (!vis[viz]) dfs(viz);
    }
}
// TODO: estudar flag pra debugar interativo
// void setRoad(int a, int b) {
//     cout << "report" << a << ' ' << b << endl;
// };

int do_query(vector<int> a, vector<int> b) {
    int tmp[MAXN], tmp2[MAXN];
    for (int i=0; i<(int)a.size(); i++) tmp[i] = a[i];
    for (int i=0; i<(int)b.size(); i++) tmp2[i] = b[i];
    // for (int i : a) cout << i << ' ';
    // cout << endl;
    // for (int i : b) cout << i << ' ';
    // cout << endl;
    // int v; cin >> v;
    // return v;
    return query((int)a.size(), (int)b.size(), tmp, tmp2);
}

void run(int N) {
    srand(time(0));
    int n = N;
    for (int e=0; e<n-1; e++) {
        bool found = false;
        for (int a=1; a<=n and !found; a++) {
            for (int b=a+1; b<=n and !found; b++) {
                if (do_query(vector<int> (1, a), vector<int> (1, b))) {
                    setRoad(a, b);
                    found = true;
                }
            }
        }
        // vector<int> src(n);
        // for (int i=0; i<n; i++) src[i] = i+1;
        // random_shuffle(src.begin(), src.end());
        // int a = 0; vector<int> dest;
        // for (int v : src) {
        //     dfs(v);
        //     for (int i=1; i<=n; i++) {
        //         if (!vis[i]) dest.push_back(i);
        //     }
        //     for (int i=1; i<=n; i++) vis[i] = false;
        //     a = v;
        //     if (do_query(vector<int> (1, v), dest)) break;
        //     dest.clear();
        // }
        // random_shuffle(dest.begin(), dest.end());
        // for (int b : dest) {
        //     if (do_query(vector<int>(1, a), vector<int> (1, b))) {
        //         setRoad(a, b);
        //         break;
        //     }
        // }
    }
}

// int main() {
//     int n; cin >> n;
//     run(n);
//     return 0;
// }

Compilation message

icc.cpp: In function 'int do_query(std::vector<int>, std::vector<int>)':
icc.cpp:30:12: error: 'query' was not declared in this scope; did you mean 'do_query'?
   30 |     return query((int)a.size(), (int)b.size(), tmp, tmp2);
      |            ^~~~~
      |            do_query
icc.cpp: In function 'void run(int)':
icc.cpp:41:21: error: 'setRoad' was not declared in this scope
   41 |                     setRoad(a, b);
      |                     ^~~~~~~