제출 #722660

#제출 시각아이디문제언어결과실행 시간메모리
722660bin9638수천개의 섬 (IOI22_islands)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #ifndef SKY #include "islands.h" #endif // SKY using namespace std; #define N 100010 #define ll long long #define fs first #define sc second #define ii pair<int,int> #define pb push_back int n,m,ktr[N]; vector<int>g[N]; void DFS(int u) { ktr[u]=1; for(auto v:g[u]) if(ktr[v]==0) DFS(v); } #ifdef SKY vector<int> #elif variant<bool, vector<int>> #endif // SKY find_journey(int NNN, int MMM, vector<int> canh_fs, vector<int> canh_sc) { n=NNN; m=MMM; for(int i=0;i<m;i++) { int u=canh_fs[i],v=canh_sc[i]; g[u].pb(v); g[v].pb(u); } if(g[0].size()>=2) { return #ifdef SKY {1}; #elif true; #endif // SKY } DFS(0); for(int i=1;i<n;i++) if(ktr[i]==1&&g[i].size()>=3) { return #ifdef SKY {1}; #elif true; #endif // SKY } return #ifdef SKY {0}; #elif false; #endif // SKY } #ifdef SKY int main() { freopen("A.inp","r",stdin); freopen("A.out","w",stdout); ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); return 0; } #endif

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

islands.cpp:29:6: error: #elif with no expression
   29 | #elif
      |      ^
islands.cpp:47:14: error: #elif with no expression
   47 |         #elif
      |              ^
islands.cpp:58:18: error: #elif with no expression
   58 |             #elif
      |                  ^
islands.cpp:65:10: error: #elif with no expression
   65 |     #elif
      |          ^
islands.cpp:32:1: error: ISO C++ forbids declaration of 'find_journey' with no type [-fpermissive]
   32 | find_journey(int NNN, int MMM, vector<int> canh_fs, vector<int> canh_sc)
      | ^~~~~~~~~~~~
islands.cpp:32:1: error: ambiguating new declaration of 'int find_journey(int, int, std::vector<int>, std::vector<int>)'
In file included from islands.cpp:4:
islands.h:4:38: note: old declaration 'std::variant<bool, std::vector<int, std::allocator<int> > > find_journey(int, int, std::vector<int>, std::vector<int>)'
    4 | std::variant<bool, std::vector<int>> find_journey(
      |                                      ^~~~~~~~~~~~
islands.cpp: In function 'int find_journey(int, int, std::vector<int>, std::vector<int>)':
islands.cpp:50:5: error: expected primary-expression before '}' token
   50 |     }
      |     ^
islands.cpp:44:15: error: expected ';' before '}' token
   44 |         return
      |               ^
      |               ;
......
   50 |     }
      |     ~          
islands.cpp:61:9: error: expected primary-expression before '}' token
   61 |         }
      |         ^
islands.cpp:55:19: error: expected ';' before '}' token
   55 |             return
      |                   ^
      |                   ;
......
   61 |         }
      |         ~          
islands.cpp:68:1: error: expected primary-expression before '}' token
   68 | }
      | ^
islands.cpp:62:10: error: expected ';' before '}' token
   62 |    return
      |          ^
      |          ;
......
   68 | }
      | ~