답안 #1074474

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1074474 2024-08-25T10:42:28 Z TB_ 통행료 (IOI18_highway) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define fo(i, n) for(ll i = 0; i<(n); i++)
#define pb push_back
#define F first
#define S second
#define deb(x) cout << #x << " = " << (x) << endl 
#define deb2(x, y) cout << #x << " = " << (x)  << ", " << #y << " = " << (y) << endl 
typedef vector<ll> vl;
typedef vector<vl> vvl;

ll ask(vector<int> w);
void anwer(ll a, ll b);


void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
    int M = U.size();
    vl invalid(N, 0);
    for (int j = 0; j < 50; ++j) {
        std::vector<int> w(M);
        for (int i = 0; i < M; ++i) {
            w[i] = rand()%2;
        }
        long long toll = ask(w);
        priority_queue<pair<ll, ll>> pq;
        pq.push({0, 0});
        vl seen(N, 0);
        ll cost, pos;
        vector<vector<pair<ll, ll>>> adj(N);
        fo(i, M){
            adj[U[i]].pb({V[i], w[i]});
            adj[V[i]].pb({U[i], w[i]});
        }
        while(!pq.empty()){
            tie(cost, pos) = pq.top();
            pq.pop();
            cost = -cost;
            if(seen[pos]) continue;
            invalid[pos]|=cost!=toll;
            seen[pos] = 1;
            for(auto &[v, w] : adj[pos]){
                pq.push({-cost-w, v});
            }
        }
    }
    int ans = 0;
    fo(i, N) if(!invalid[i]) ans = i; 
    answer(0, ans);
}

Compilation message

highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:51:5: error: 'answer' was not declared in this scope; did you mean 'anwer'?
   51 |     answer(0, ans);
      |     ^~~~~~
      |     anwer