답안 #120790

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
120790 2019-06-25T13:41:40 Z win11905 게임 (IOI14_game) C++11
컴파일 오류
0 ms 0 KB
#include "game.h"
#include <set>
using namespace std;

set<int> S[1505];
bool not[1505];

void initialize(int n) {
    for(int i = 0; i < n; ++i) for(int j = 0; j < n; ++j) if(i != j) {
        S[i].emplace(j);
    }
}

int hasEdge(int u, int v) {
    bool st = S[u].size() <= 1 || S[v].size() <= 1;
    if(S[u].count(v)) S[u].erase(v);
    if(S[v].count(u)) S[v].erase(u);
    if(st) not[u] = not[v] = true;
    if(S[u].size() == 1 && not[u] == false) {
        int a = *S[u].begin();
        if(S[a].count(u)) S[a].erase(u);
    } 
    if(S[v].size() == 1 && not[v] == false) {
        int a = *S[v].begin();
        if(S[a].count(v)) S[a].erase(v);
    }
    return st;
}

Compilation message

game.cpp:6:6: error: expected unqualified-id before 'not' token
 bool not[1505];
      ^~~
game.cpp: In lambda function:
game.cpp:18:19: error: expected '{' before '=' token
     if(st) not[u] = not[v] = true;
                   ^
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:18:12: error: no match for 'operator!' (operand type is 'hasEdge(int, int)::<lambda()>')
     if(st) not[u] = not[v] = true;
game.cpp:18:12: note: candidate: operator!(bool) <built-in>
game.cpp:18:12: note:   no known conversion for argument 1 from 'hasEdge(int, int)::<lambda()>' to 'bool'
game.cpp: In lambda function:
game.cpp:18:28: error: expected '{' before '=' token
     if(st) not[u] = not[v] = true;
                            ^
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:18:21: error: no match for 'operator!' (operand type is 'hasEdge(int, int)::<lambda()>')
     if(st) not[u] = not[v] = true;
game.cpp:18:21: note: candidate: operator!(bool) <built-in>
game.cpp:18:21: note:   no known conversion for argument 1 from 'hasEdge(int, int)::<lambda()>' to 'bool'
game.cpp: In lambda function:
game.cpp:19:35: error: expected '{' before '==' token
     if(S[u].size() == 1 && not[u] == false) {
                                   ^~
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:19:28: error: no match for 'operator!' (operand type is 'hasEdge(int, int)::<lambda()>')
     if(S[u].size() == 1 && not[u] == false) {
game.cpp:19:28: note: candidate: operator!(bool) <built-in>
game.cpp:19:28: note:   no known conversion for argument 1 from 'hasEdge(int, int)::<lambda()>' to 'bool'
game.cpp: In lambda function:
game.cpp:23:35: error: expected '{' before '==' token
     if(S[v].size() == 1 && not[v] == false) {
                                   ^~
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:23:28: error: no match for 'operator!' (operand type is 'hasEdge(int, int)::<lambda()>')
     if(S[v].size() == 1 && not[v] == false) {
game.cpp:23:28: note: candidate: operator!(bool) <built-in>
game.cpp:23:28: note:   no known conversion for argument 1 from 'hasEdge(int, int)::<lambda()>' to 'bool'