제출 #979504

#제출 시각아이디문제언어결과실행 시간메모리
979504ducksaysquack자매 도시 (APIO20_swap)C++17
컴파일 에러
0 ms0 KiB
#include "swap.h" #include <bits/stdc++.h> #define pb push_back #define f first #define s second using namespace std; int n, m; vector<pair<int,pair<int,int>>> e; vector<int> to(1e5+5); void init(int N, int M, vector<int> U, vector<int> V, vector<int> W) { n = N, m = M; for(int i=0;i<m;i++) {e.pb({W[i],{U[i],V[i]}}); to[V[i]] = W[i];} sort(begin(e),end(e)); } int getMinimumFuelCapacity(int x, int y) { if(n <= 3) return -1; if(x > y) swap(x,y); if(x == 0) { int cnt = 0, mx = to[y]; for(int i=0;i<m;i++) if(e[i].s.s != y) { cnt++, mx = max(mx, e[i].f); if(cnt >= 2) return mx; } } else for(int i=0;i<m;i++) if(e[i].s.s != x && e[i].s.s != y) return max({to[x], to[y], e[i].f});

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

swap.cpp: In function 'int getMinimumFuelCapacity(int, int)':
swap.cpp:25:2: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   25 |  else for(int i=0;i<m;i++) if(e[i].s.s != x && e[i].s.s != y) return max({to[x], to[y], e[i].f});
      |  ^~~~
swap.cpp:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   25 |  else for(int i=0;i<m;i++) if(e[i].s.s != x && e[i].s.s != y) return max({to[x], to[y], e[i].f});
      | 
swap.cpp:25:97: error: expected '}' at end of input
   25 |  else for(int i=0;i<m;i++) if(e[i].s.s != x && e[i].s.s != y) return max({to[x], to[y], e[i].f});
      |                                                                                                 ^
swap.cpp:15:42: note: to match this '{'
   15 | int getMinimumFuelCapacity(int x, int y) {
      |                                          ^
swap.cpp:25:97: warning: control reaches end of non-void function [-Wreturn-type]
   25 |  else for(int i=0;i<m;i++) if(e[i].s.s != x && e[i].s.s != y) return max({to[x], to[y], e[i].f});
      |                                                                                                 ^