제출 #422077

#제출 시각아이디문제언어결과실행 시간메모리
422077SAAD게임 (IOI14_game)C++17
0 / 100
1 ms332 KiB
#define F first
#define S second
#define rep(i,a,b) for(int i=a;!(a==b&&i!=b)&&((i<=b&&b>=a)||(i>=b&&a>=b));i+=(a<=b?1:-1))
#define pb push_back
#define Fbitl __builtin_ffs
#define bit1 __builtin_popcount
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string.h>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
int j, c, th[1502], n, res;
bool who[1502];
short int x[1502][1502];
void initialize(int n) {
    ::n = n;
    j = n * (n - 1) / 2;
}
int hasEdge(int u, int v) {
    c++;
    int ans = 0;
    if (v < u) swap(v, u);
    if (!x[u][v]) th[u]++; th[v]++;
    if ( x[u][v] == 2 ) {
        ans = 1;
    }
    else if ((th[u] != n - 1) && (th[v] != n - 1) ) {
        ans = 0;
        x[u][v] = x[v][u] = 1;
    }
    else {
        x[u][v] = x[v][u] = 2;
        who[u] = true;
        ans = 1;
    }
    if (th[u] == n - 2) {
        for (int i = 0; i < n; i++) {
            if ( !x[u][i] && u != i && !who[i] ) {
                x[u][i] = x[i][u] = 2;
                who[i] = true;
                th[i]++; th[u]++;
                break;
            }
        }
    }
    if (th[v] == n - 2) {
        for (int i = 0; i < n; i++) {
            if ( !x[v][i] && v != i && !who[i]) {
                x[i][v] = x[v][i] = 2;
                th[v]++; th[i]++;
                who[i] = true;
                break;
            }
        }
    }
    return ans;
}

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

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:37:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   37 |     if (!x[u][v]) th[u]++; th[v]++;
      |     ^~
game.cpp:37:28: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   37 |     if (!x[u][v]) th[u]++; th[v]++;
      |                            ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...