제출 #193138

#제출 시각아이디문제언어결과실행 시간메모리
193138anubhavdhar게임 (IOI14_game)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #define ll long long int #define pb push_back #define mp make_pair #define FOR(i,n) for(i=0;i<n;i++) #define FORe(i,n) for(i=1;i<=n;i++) #define FORr(i,a,b) for(i=a;i<b;i++) #define ii pair<ll,ll> #define vi vector<ll> #define vii vector<ii> #define ff first #define ss second #define cd complex<double> #define vcd vector<cd> using namespace std; #include "game.h" /* const ll MAXN = 1511;//2e5+5; const ll MOD = 1e9+7; const ll ROOTN = 320; const ll LOGN = 17; const ll INF = 1e17 + 1101; */ int g[MAXN][MAXN],id[MAXN],sz[MAXN],N; inline int root(int x) { while(x != id[x]) { id[x] = id[id[x]]; x = id[x]; } return x; } /* inline void DBG() { ll i; FOR(i,N) cout<<"id["<<i<<"] = "<<i<<endl; } */ inline void mrg(int a,int b) { int i,x = root(a),y = root(b); if(x != y) { if (sz[x] > sz[y]) swap(x,y); id[x] = y; sz[y] += sz[x]; sz[x] = 0; FOR(i,N) if(sz[i]) g[y][i] = g[i][y] = g[i][y] + g[i][x]; } } void initialize(int n) { N = n; int i,j; FOR(i,N) { id[i] = i; sz[i] = 1; FOR(j,N) g[i][j] = 0; } //DBG(); } int hasEdge(int u,int v) { int p = root(u),q = root(v); if (p == q) { cout<<"DANGER"; return -1; } g[p][q]++; g[q][p]++; if (g[p][q] == sz[p]*sz[q]) { mrg(p,q); return 1; } return 0; } /* inline void PlayGame(ll r) { ll a,b; while(r--) { cin>>a>>b; cout<<hasEdge(a,b)<<endl; } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll n; cin>>n; initialize(n); PlayGame((n*(n-1))/2); return 0; }*/

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

game.cpp:28:7: error: 'MAXN' was not declared in this scope
 int g[MAXN][MAXN],id[MAXN],sz[MAXN],N;
       ^~~~
game.cpp:28:7: note: suggested alternative: 'NAN'
 int g[MAXN][MAXN],id[MAXN],sz[MAXN],N;
       ^~~~
       NAN
game.cpp:28:13: error: 'MAXN' was not declared in this scope
 int g[MAXN][MAXN],id[MAXN],sz[MAXN],N;
             ^~~~
game.cpp:28:13: note: suggested alternative: 'NAN'
 int g[MAXN][MAXN],id[MAXN],sz[MAXN],N;
             ^~~~
             NAN
game.cpp:28:22: error: 'MAXN' was not declared in this scope
 int g[MAXN][MAXN],id[MAXN],sz[MAXN],N;
                      ^~~~
game.cpp:28:22: note: suggested alternative: 'NAN'
 int g[MAXN][MAXN],id[MAXN],sz[MAXN],N;
                      ^~~~
                      NAN
game.cpp:28:31: error: 'MAXN' was not declared in this scope
 int g[MAXN][MAXN],id[MAXN],sz[MAXN],N;
                               ^~~~
game.cpp:28:31: note: suggested alternative: 'NAN'
 int g[MAXN][MAXN],id[MAXN],sz[MAXN],N;
                               ^~~~
                               NAN
game.cpp: In function 'int root(int)':
game.cpp:32:13: error: 'id' was not declared in this scope
  while(x != id[x])
             ^~
game.cpp:32:13: note: suggested alternative: 'ii'
  while(x != id[x])
             ^~
             ii
game.cpp: In function 'void mrg(int, int)':
game.cpp:52:7: error: 'sz' was not declared in this scope
   if (sz[x] > sz[y])
       ^~
game.cpp:52:7: note: suggested alternative: 'ss'
   if (sz[x] > sz[y])
       ^~
       ss
game.cpp:54:3: error: 'id' was not declared in this scope
   id[x] = y;
   ^~
game.cpp:54:3: note: suggested alternative: 'i'
   id[x] = y;
   ^~
   i
game.cpp:55:3: error: 'sz' was not declared in this scope
   sz[y] += sz[x];
   ^~
game.cpp:55:3: note: suggested alternative: 'ss'
   sz[y] += sz[x];
   ^~
   ss
game.cpp:59:5: error: 'g' was not declared in this scope
     g[y][i] = g[i][y] = g[i][y] + g[i][x];
     ^
game.cpp: In function 'void initialize(int)':
game.cpp:69:3: error: 'id' was not declared in this scope
   id[i] = i;
   ^~
game.cpp:69:3: note: suggested alternative: 'i'
   id[i] = i;
   ^~
   i
game.cpp:70:3: error: 'sz' was not declared in this scope
   sz[i] = 1;
   ^~
game.cpp:70:3: note: suggested alternative: 'ss'
   sz[i] = 1;
   ^~
   ss
game.cpp:72:4: error: 'g' was not declared in this scope
    g[i][j] = 0;
    ^
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:87:2: error: 'g' was not declared in this scope
  g[p][q]++;
  ^
game.cpp:89:17: error: 'sz' was not declared in this scope
  if (g[p][q] == sz[p]*sz[q])
                 ^~
game.cpp:89:17: note: suggested alternative: 'ss'
  if (g[p][q] == sz[p]*sz[q])
                 ^~
                 ss