제출 #979619

#제출 시각아이디문제언어결과실행 시간메모리
979619vjudge1Swapping Cities (APIO20_swap)C++17
컴파일 에러
0 ms0 KiB
#include <time.h> #include <cstdlib> #include <stack> #include <numeric> #include <unordered_map> #include <unordered_set> #include <iomanip> #include <map> #include <set> #include <iterator> #include <deque> #include <queue> #include <sstream> #include <array> #include <string> #include <tuple> #include <chrono> #include <cassert> #include <cstdio> #include <cstring> #include <list> #include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <bitset> #include "swap.h" #include <cassert> #include <cstdio> #include <string> #include <vector> // using namespace std; vector<pair<int, int>> g[200005]; pair<int, int> p[200005]; map<pair<int, int>, int> mp, pos; set<pair<int, int>> st; int N, M; void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) { } int getMinimumFuelCapacity(int X, int Y) { X++; Y++; if(N <= 3) return -1; int mx = 0; if(X != 1) mx = mp[{1, X}]; if(Y != 1) mx = max(mx, mp[{1, Y}]); if(X != 1) st.erase({mp[{1, X}], pos[{1, X}]}); if(Y != 1) st.erase({mp[{1, Y}], pos[{1, Y}]}); pair<int, int> p = *st.begin(); st.erase(st.begin()); if(X != 1 && Y != 1){ st.insert(p); if(X != 1) st.insert({mp[{1, X}], pos[{1, X}]}); if(Y != 1) st.insert({mp[{1, Y}], pos[{1, Y}]}); return max(mx, p.first); } else{ pair<int, int> p1 = *st.begin(); st.insert(p1); st.insert(p); if(X != 1) st.insert({mp[{1, X}], pos[{1, X}]}); if(Y != 1) st.insert({mp[{1, Y}], pos[{1, Y}]}); return max({mx, p.first, p1.first}); } }

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

swap.cpp:38:1: error: 'vector' does not name a type
   38 | vector<pair<int, int>> g[200005];
      | ^~~~~~
swap.cpp:39:1: error: 'pair' does not name a type
   39 | pair<int, int> p[200005];
      | ^~~~
swap.cpp:40:1: error: 'map' does not name a type
   40 | map<pair<int, int>, int> mp, pos;
      | ^~~
swap.cpp:41:1: error: 'set' does not name a type
   41 | set<pair<int, int>> st;
      | ^~~
swap.cpp: In function 'int getMinimumFuelCapacity(int, int)':
swap.cpp:53:21: error: 'mp' was not declared in this scope; did you mean 'mx'?
   53 |     if(X != 1) mx = mp[{1, X}];
      |                     ^~
      |                     mx
swap.cpp:54:29: error: 'mp' was not declared in this scope; did you mean 'mx'?
   54 |     if(Y != 1) mx = max(mx, mp[{1, Y}]);
      |                             ^~
      |                             mx
swap.cpp:54:21: error: 'max' was not declared in this scope; did you mean 'std::max'?
   54 |     if(Y != 1) mx = max(mx, mp[{1, Y}]);
      |                     ^~~
      |                     std::max
In file included from /usr/include/c++/10/algorithm:62,
                 from swap.cpp:25:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
swap.cpp:57:16: error: 'st' was not declared in this scope; did you mean 'std'?
   57 |     if(X != 1) st.erase({mp[{1, X}], pos[{1, X}]});
      |                ^~
      |                std
swap.cpp:57:26: error: 'mp' was not declared in this scope; did you mean 'mx'?
   57 |     if(X != 1) st.erase({mp[{1, X}], pos[{1, X}]});
      |                          ^~
      |                          mx
swap.cpp:57:38: error: 'pos' was not declared in this scope; did you mean 'pow'?
   57 |     if(X != 1) st.erase({mp[{1, X}], pos[{1, X}]});
      |                                      ^~~
      |                                      pow
swap.cpp:58:16: error: 'st' was not declared in this scope; did you mean 'std'?
   58 |     if(Y != 1) st.erase({mp[{1, Y}], pos[{1, Y}]});
      |                ^~
      |                std
swap.cpp:58:26: error: 'mp' was not declared in this scope; did you mean 'mx'?
   58 |     if(Y != 1) st.erase({mp[{1, Y}], pos[{1, Y}]});
      |                          ^~
      |                          mx
swap.cpp:58:38: error: 'pos' was not declared in this scope; did you mean 'pow'?
   58 |     if(Y != 1) st.erase({mp[{1, Y}], pos[{1, Y}]});
      |                                      ^~~
      |                                      pow
swap.cpp:60:5: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   60 |     pair<int, int> p = *st.begin();
      |     ^~~~
      |     std::pair
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/deque:60,
                 from /usr/include/c++/10/stack:60,
                 from swap.cpp:3:
/usr/include/c++/10/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
swap.cpp:60:10: error: expected primary-expression before 'int'
   60 |     pair<int, int> p = *st.begin();
      |          ^~~
swap.cpp:61:5: error: 'st' was not declared in this scope; did you mean 'std'?
   61 |     st.erase(st.begin());
      |     ^~
      |     std
swap.cpp:63:19: error: 'p' was not declared in this scope
   63 |         st.insert(p);
      |                   ^
swap.cpp:64:31: error: 'mp' was not declared in this scope; did you mean 'mx'?
   64 |         if(X != 1) st.insert({mp[{1, X}], pos[{1, X}]});
      |                               ^~
      |                               mx
swap.cpp:64:43: error: 'pos' was not declared in this scope; did you mean 'pow'?
   64 |         if(X != 1) st.insert({mp[{1, X}], pos[{1, X}]});
      |                                           ^~~
      |                                           pow
swap.cpp:65:31: error: 'mp' was not declared in this scope; did you mean 'mx'?
   65 |         if(Y != 1) st.insert({mp[{1, Y}], pos[{1, Y}]});
      |                               ^~
      |                               mx
swap.cpp:65:43: error: 'pos' was not declared in this scope; did you mean 'pow'?
   65 |         if(Y != 1) st.insert({mp[{1, Y}], pos[{1, Y}]});
      |                                           ^~~
      |                                           pow
swap.cpp:66:16: error: 'max' was not declared in this scope; did you mean 'std::max'?
   66 |         return max(mx, p.first);
      |                ^~~
      |                std::max
In file included from /usr/include/c++/10/algorithm:62,
                 from swap.cpp:25:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
swap.cpp:69:14: error: expected primary-expression before 'int'
   69 |         pair<int, int> p1 = *st.begin();
      |              ^~~
swap.cpp:70:19: error: 'p1' was not declared in this scope; did you mean 'y1'?
   70 |         st.insert(p1);
      |                   ^~
      |                   y1
swap.cpp:71:19: error: 'p' was not declared in this scope
   71 |         st.insert(p);
      |                   ^
swap.cpp:72:31: error: 'mp' was not declared in this scope; did you mean 'mx'?
   72 |         if(X != 1) st.insert({mp[{1, X}], pos[{1, X}]});
      |                               ^~
      |                               mx
swap.cpp:72:43: error: 'pos' was not declared in this scope; did you mean 'pow'?
   72 |         if(X != 1) st.insert({mp[{1, X}], pos[{1, X}]});
      |                                           ^~~
      |                                           pow
swap.cpp:73:31: error: 'mp' was not declared in this scope; did you mean 'mx'?
   73 |         if(Y != 1) st.insert({mp[{1, Y}], pos[{1, Y}]});
      |                               ^~
      |                               mx
swap.cpp:73:43: error: 'pos' was not declared in this scope; did you mean 'pow'?
   73 |         if(Y != 1) st.insert({mp[{1, Y}], pos[{1, Y}]});
      |                                           ^~~
      |                                           pow
swap.cpp:74:16: error: 'max' was not declared in this scope; did you mean 'std::max'?
   74 |         return max({mx, p.first, p1.first});
      |                ^~~
      |                std::max
In file included from /usr/include/c++/10/algorithm:62,
                 from swap.cpp:25:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~