제출 #736602

#제출 시각아이디문제언어결과실행 시간메모리
736602ngano_upat_na게임 (IOI14_game)C++17
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h"
#include "game.h"
using namespace std;

int ct, N;
vector<pair<int,int>> v;

void initialize(int n) {
    ct = n * (n - 1) / 2;
    N = n;
    
    for (int i=0; i<n-2; i++) {
        v.push_back({i,i+1});
    }
}

int hasEdge(int u, int v) {
    int U = min(u,v), V = max(u,v);
    ct--;
    if (binary_search(v.begin(),v.end(),{U,V}) || ct == 0) {
        return 1;
    }   
    return 0;   
}   

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

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:20:25: error: request for member 'begin' in 'v', which is of non-class type 'int'
   20 |     if (binary_search(v.begin(),v.end(),{U,V}) || ct == 0) {
      |                         ^~~~~
game.cpp:20:35: error: request for member 'end' in 'v', which is of non-class type 'int'
   20 |     if (binary_search(v.begin(),v.end(),{U,V}) || ct == 0) {
      |                                   ^~~