Submission #672541

#TimeUsernameProblemLanguageResultExecution timeMemory
672541mmk악어의 지하 도시 (IOI11_crocodile)C++14
Compilation error
0 ms0 KiB
#include "crocodile.h" #include<bits/stdc++.h> #define INF 0x3f3f3f3f3f3f3f3f #define ll long long; using namespace std; const int MAXN = 1e5+10; ll Dist1[MAXN], Dist2[MAXN]; int marc[MAXN]; vector<int> grafo[MAXN]; vector<int> weight[MAXN]; ll travel_plan(int n, int m, int R[][2], int L[], int K, int P[]) { for(int i = 0; i < n; i++) { int a = r[i][0]; int b = r[i][1]; grafo[a].push_back(b); grafo[b].push_back(a); weight[a].push_back(l[i]); weight[b].push_back(l[i]); } set<pair<ll,int>> s; for(int i = 0; i < n; i++) { Dist1[i] = INF; Dist2[i] = INF; } for(int i = 0; i < k; i++) { Dist1[p[i]] = 0; Dist2[p[i]] = 0; s.insert({0,p[i]}); } while(!s.empty()) { int cur = s.begin()->second; if(marc[cur] == 1) continue; marc[cur] = 1; for(int i = 0; i < grafo[cur].size(); i++) { int viz grafo[cur][i]; ll p = weight[cur][i]; if(Dist2[cur] + p < Dist1[viz]) { Dist2[viz] = Dist1[viz]; Dist1[viz] = Dist2[cur] + p; s.insert({Dist2[viz],viz}); } else if(Dist2[cur] + p < Dist2[viz]) { Dist2[viz] = Dist2[cur] + p; s.insert({Dist2[viz],viz}); } } } return Dist2[0]; }

Compilation message (stderr)

crocodile.cpp:4:17: error: declaration does not declare anything [-fpermissive]
    4 | #define ll long long;
      |                 ^~~~
crocodile.cpp:7:1: note: in expansion of macro 'll'
    7 | ll Dist1[MAXN], Dist2[MAXN];
      | ^~
crocodile.cpp:7:4: error: 'Dist1' does not name a type
    7 | ll Dist1[MAXN], Dist2[MAXN];
      |    ^~~~~
crocodile.cpp:4:17: error: declaration does not declare anything [-fpermissive]
    4 | #define ll long long;
      |                 ^~~~
crocodile.cpp:11:1: note: in expansion of macro 'll'
   11 | ll travel_plan(int n, int m, int R[][2], int L[], int K, int P[])
      | ^~
crocodile.cpp:11:4: error: ISO C++ forbids declaration of 'travel_plan' with no type [-fpermissive]
   11 | ll travel_plan(int n, int m, int R[][2], int L[], int K, int P[])
      |    ^~~~~~~~~~~
crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:15:11: error: 'r' was not declared in this scope
   15 |   int a = r[i][0];
      |           ^
crocodile.cpp:19:23: error: 'l' was not declared in this scope
   19 |   weight[a].push_back(l[i]);
      |                       ^
crocodile.cpp:4:17: error: wrong number of template arguments (1, should be 2)
    4 | #define ll long long;
      |                 ^~~~
crocodile.cpp:22:11: note: in expansion of macro 'll'
   22 |  set<pair<ll,int>> s;
      |           ^~
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from crocodile.cpp:2:
/usr/include/c++/10/bits/stl_pair.h:211:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
  211 |     struct pair
      |            ^~~~
crocodile.cpp:22:6: error: template argument 1 is invalid
   22 |  set<pair<ll,int>> s;
      |      ^
crocodile.cpp:22:6: error: template argument 2 is invalid
crocodile.cpp:22:6: error: template argument 3 is invalid
crocodile.cpp:22:13: error: expected primary-expression before ',' token
   22 |  set<pair<ll,int>> s;
      |             ^
crocodile.cpp:22:14: error: expected primary-expression before 'int'
   22 |  set<pair<ll,int>> s;
      |              ^~~
crocodile.cpp:25:3: error: 'Dist1' was not declared in this scope
   25 |   Dist1[i] = INF;
      |   ^~~~~
crocodile.cpp:26:3: error: 'Dist2' was not declared in this scope
   26 |   Dist2[i] = INF;
      |   ^~~~~
crocodile.cpp:28:21: error: 'k' was not declared in this scope
   28 |  for(int i = 0; i < k; i++)
      |                     ^
crocodile.cpp:30:3: error: 'Dist1' was not declared in this scope
   30 |   Dist1[p[i]] = 0;
      |   ^~~~~
crocodile.cpp:30:9: error: 'p' was not declared in this scope
   30 |   Dist1[p[i]] = 0;
      |         ^
crocodile.cpp:31:3: error: 'Dist2' was not declared in this scope
   31 |   Dist2[p[i]] = 0;
      |   ^~~~~
crocodile.cpp:32:3: error: 's' was not declared in this scope
   32 |   s.insert({0,p[i]});
      |   ^
crocodile.cpp:34:9: error: 's' was not declared in this scope
   34 |  while(!s.empty())
      |         ^
crocodile.cpp:39:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |   for(int i = 0; i < grafo[cur].size(); i++)
      |                  ~~^~~~~~~~~~~~~~~~~~~
crocodile.cpp:41:13: error: expected initializer before 'grafo'
   41 |    int viz  grafo[cur][i];
      |             ^~~~~
crocodile.cpp:4:17: error: declaration does not declare anything [-fpermissive]
    4 | #define ll long long;
      |                 ^~~~
crocodile.cpp:42:4: note: in expansion of macro 'll'
   42 |    ll p = weight[cur][i];
      |    ^~
crocodile.cpp:42:7: error: 'p' was not declared in this scope
   42 |    ll p = weight[cur][i];
      |       ^
crocodile.cpp:43:7: error: 'Dist2' was not declared in this scope
   43 |    if(Dist2[cur] + p < Dist1[viz])
      |       ^~~~~
crocodile.cpp:43:24: error: 'Dist1' was not declared in this scope
   43 |    if(Dist2[cur] + p < Dist1[viz])
      |                        ^~~~~
crocodile.cpp:43:30: error: 'viz' was not declared in this scope
   43 |    if(Dist2[cur] + p < Dist1[viz])
      |                              ^~~
crocodile.cpp:56:9: error: 'Dist2' was not declared in this scope
   56 |  return Dist2[0];
      |         ^~~~~