제출 #143637

#제출 시각아이디문제언어결과실행 시간메모리
143637HIR180장난감 기차 (IOI17_train)C++14
컴파일 에러
0 ms0 KiB
#pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; typedef long long ll; typedef pair<int,int> P; typedef pair<int,P> P1; typedef pair<P,P> P2; #define pu push #define pb push_back #define mp make_pair #define eps 1e-7 #define INF 1000000000 #define mod 1000000007 #define fi first #define sc second #define rep(i,x) for(int i=0;i<x;i++) #define repn(i,x) for(int i=1;i<=x;i++) #define SORT(x) sort(x.begin(),x.end()) #define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end()) #define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) #define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) vector<int>edge[5005],redge[5005]; int cnt[5005]; bool used[5005]; vector<int>who_wins(vector<int>a,vector<int>r,vector<int>u,vector<int>v){ int cnt = 0; rep(i,r.size()) cnt += r[i]; if(cnt != 1) return vector<int>(); int V; rep(i,r.size()) if(r[i]) V = i; rep(i,u.size()){ edge[u[i]].pb(v[i]); redge[v[i]].pb(u[i]); cnt[u[i]]++; } queue<int>que; used[V] = 1; rep(i,redge[V].size()){ int to = redge[V][i]; if(a[to] == 0) que.push(to); else{ cnt[to]--; if(cnt[to] == 0) que.push(to); } } bool ok = 0; while(!que.size()){ int q = que.front(); que.pop(); if(q == V) ok = 1; if(used[q]) continue; used[q] = 1; rep(i,redge[q].size()){ int to = redge[q][i]; if(a[to] == 0) que.push(to); else{ cnt[to]--; if(cnt[to] == 0) que.push(to); } } } if(!ok){ vector<int>ret; rep(i,a.size()) ret.pb(1); return ret; } else{ vector<int>ret; rep(i,a.size()) if(!used[i]) ret.pb(1);else ret.pb(0); return ret; } }

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

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:20:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,x) for(int i=0;i<x;i++)
train.cpp:31:6:
  rep(i,r.size()) cnt += r[i];
      ~~~~~~~~~~                
train.cpp:31:2: note: in expansion of macro 'rep'
  rep(i,r.size()) cnt += r[i];
  ^~~
train.cpp:20:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,x) for(int i=0;i<x;i++)
train.cpp:34:6:
  rep(i,r.size()) if(r[i]) V = i;
      ~~~~~~~~~~                
train.cpp:34:2: note: in expansion of macro 'rep'
  rep(i,r.size()) if(r[i]) V = i;
  ^~~
train.cpp:20:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,x) for(int i=0;i<x;i++)
train.cpp:35:6:
  rep(i,u.size()){
      ~~~~~~~~~~                
train.cpp:35:2: note: in expansion of macro 'rep'
  rep(i,u.size()){
  ^~~
train.cpp:38:11: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}]' for array subscript
   cnt[u[i]]++;
           ^
train.cpp:20:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,x) for(int i=0;i<x;i++)
train.cpp:41:6:
  rep(i,redge[V].size()){
      ~~~~~~~~~~~~~~~~~         
train.cpp:41:2: note: in expansion of macro 'rep'
  rep(i,redge[V].size()){
  ^~~
train.cpp:45:10: error: invalid types 'int[int]' for array subscript
    cnt[to]--;
          ^
train.cpp:46:13: error: invalid types 'int[int]' for array subscript
    if(cnt[to] == 0) que.push(to);
             ^
train.cpp:53:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   if(used[q]) continue; used[q] = 1;
   ^~
train.cpp:53:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   if(used[q]) continue; used[q] = 1;
                         ^~~~
train.cpp:20:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,x) for(int i=0;i<x;i++)
train.cpp:54:7:
   rep(i,redge[q].size()){
       ~~~~~~~~~~~~~~~~~        
train.cpp:54:3: note: in expansion of macro 'rep'
   rep(i,redge[q].size()){
   ^~~
train.cpp:58:11: error: invalid types 'int[int]' for array subscript
     cnt[to]--;
           ^
train.cpp:59:14: error: invalid types 'int[int]' for array subscript
     if(cnt[to] == 0) que.push(to);
              ^
train.cpp:20:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,x) for(int i=0;i<x;i++)
train.cpp:64:23:
   vector<int>ret; rep(i,a.size()) ret.pb(1);
                       ~~~~~~~~~~
train.cpp:64:19: note: in expansion of macro 'rep'
   vector<int>ret; rep(i,a.size()) ret.pb(1);
                   ^~~
train.cpp:20:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,x) for(int i=0;i<x;i++)
train.cpp:68:23:
   vector<int>ret; rep(i,a.size()) if(!used[i]) ret.pb(1);else ret.pb(0);
                       ~~~~~~~~~~
train.cpp:68:19: note: in expansion of macro 'rep'
   vector<int>ret; rep(i,a.size()) if(!used[i]) ret.pb(1);else ret.pb(0);
                   ^~~