제출 #255551

#제출 시각아이디문제언어결과실행 시간메모리
255551Hehehe장난감 기차 (IOI17_train)C++14
컴파일 에러
0 ms0 KiB
#include "train.h" #include<bits/stdc++.h> //:3 using namespace std; typedef long long ll; #define all(a) (a).begin(), (a).end() #define ff first #define ss second #define pb push_back #define mp make_pair #define pi pair<long double, long double> #define sz(x) (int)((x).size()) const int N = 5e3 + 11; int n, m; int ok[MN], DEG[N], deg[N], a[N], r[N], viz[N], station[N], prev[MN], flag; vector<int>adj[N]; void bfs(){ for(int i = 0; i < n; i++){ viz[i] = 0; prev[i] = ok[i]; station[i] = 1; deg[i] = DEG[i]; } queue<int>q; for(int i = 0; i < n; i++){ if(!ok || !r[i])continue; station[i] = 1; for(auto it : adj[i]){ if(viz[it])continue; if(a[it] || !(--deg[it])){ viz[it] = 1; q.push(it); } } } for(int i = 0; i < n; i++)ok[i] = 0; while(!q.empty()){ int i = q.front(); q.pop(); ok[i] = 1; if(station[i])continue; for(auto it : adj[i]){ if(viz[it])continue; if(a[it] || !(--deg[it])){ viz[it] = 1; q.push(it); } } } int fl = 0; for(int i = 0; i < n; i++){ if(ok[i] != prev[i])fl = 1; } if(!fl)flag = 1; } vector<int> who_wins(vector<int> A, vector<int> R, vector<int> u, vector<int> v){ n = sz(A); m = sz(u); for(int i = 0; i < n; i++){ r[i] = R[i]; a[i] = A[i]; } for(int i = 0; i < m; i++){ adj[v[i]].push_back(u[i]); } for(int i = 0; i < n; i++){ for(auto it : adj[i]){ DEG[it]++; } } memset(ok, 1, sizeof(ok)); for(int i = 0; i < n && !flag; i++){ bfs(); } vector<int> res; for(i = 0;i < n; i++){ res.push_back(ok[i]); } return res; }

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

train.cpp:15:8: error: 'MN' was not declared in this scope
 int ok[MN], DEG[N], deg[N], a[N], r[N], viz[N], station[N], prev[MN], flag;
        ^~
train.cpp:15:8: note: suggested alternative: 'N'
 int ok[MN], DEG[N], deg[N], a[N], r[N], viz[N], station[N], prev[MN], flag;
        ^~
        N
train.cpp:15:66: error: 'MN' was not declared in this scope
 int ok[MN], DEG[N], deg[N], a[N], r[N], viz[N], station[N], prev[MN], flag;
                                                                  ^~
train.cpp:15:66: note: suggested alternative: 'N'
 int ok[MN], DEG[N], deg[N], a[N], r[N], viz[N], station[N], prev[MN], flag;
                                                                  ^~
                                                                  N
train.cpp: In function 'void bfs()':
train.cpp:22:15: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
         prev[i] = ok[i];
               ^
train.cpp:22:19: error: 'ok' was not declared in this scope
         prev[i] = ok[i];
                   ^~
train.cpp:30:13: error: 'ok' was not declared in this scope
         if(!ok || !r[i])continue;
             ^~
train.cpp:44:31: error: 'ok' was not declared in this scope
     for(int i = 0; i < n; i++)ok[i] = 0;
                               ^~
train.cpp:51:9: error: 'ok' was not declared in this scope
         ok[i] = 1;
         ^~
train.cpp:66:12: error: 'ok' was not declared in this scope
         if(ok[i] != prev[i])fl = 1;
            ^~
train.cpp:66:27: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
         if(ok[i] != prev[i])fl = 1;
                           ^
train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:92:12: error: 'ok' was not declared in this scope
     memset(ok, 1, sizeof(ok));
            ^~
train.cpp:99:9: error: 'i' was not declared in this scope
     for(i = 0;i < n; i++){
         ^