Submission #1082177

#TimeUsernameProblemLanguageResultExecution timeMemory
1082177logangdGame (IOI14_game)C++14
Compilation error
0 ms0 KiB
#include "game.h"
#include<set>
using namespace std;

int N,vs[1500],c=0;
set<int>ar[1500];

void initialize(int n) {
    N=n;
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            if(i!=j)ar[i].insert(j),ar[j].insert(i);
}

bool dfs(int u,int v){
    if(u==v)return 1;
    vs[u]=c;
    for(auto i:ar[u])
        if(vs[i]!=c)
            if(dfs(i,v))return 1;
    return 0;
}

int hasEdge(int u,int v){
    c++;
    ar[u].remove(v);
    ar[v].remove(u);
    if(dfs(u,v))return 0;
    ar[u].insert(v);
    ar[v].insert(u);
    return 1;
}

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:26:11: error: 'class std::set<int>' has no member named 'remove'
   26 |     ar[u].remove(v);
      |           ^~~~~~
game.cpp:27:11: error: 'class std::set<int>' has no member named 'remove'
   27 |     ar[v].remove(u);
      |           ^~~~~~