Submission #1098384

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10983842024-10-09 10:58:07MMihalevHighway Tolls (IOI18_highway)C++14
Compilation error
0 ms0 KiB
#include "highway.h"
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
const int MAX_N=1e5+5;
int n,m;
vector<int>w;
vector<pair<int,int> >g[MAX_N];
long long edges,cost;
int root;
int a,b;
int parent[MAX_N];
int paredge[MAX_N];
int depth[MAX_N];
vector<int>leaves;
vector<int>ends;
void initdfs(int u,int par)
{
parent[u]=par;
for(auto [v,edge] : g[u])
{
if(v==par)continue;
depth[v]=depth[u]+1;
paredge[v]=edge;
initdfs(v,u);
}
}
int onpath(int l,int r)
{
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

highway.cpp: In function 'void initdfs(int, int)':
highway.cpp:21:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   21 |     for(auto [v,edge] : g[u])
      |              ^
highway.cpp: In function 'int onpath(int, int)':
highway.cpp:36:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   36 |         for(auto [v,edge]:g[u])
      |                  ^
highway.cpp:44:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   44 |         for(auto [v,edge]:g[u])
      |                  ^
highway.cpp: In function 'void markdfs(int, bool)':
highway.cpp:59:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   59 |     for(auto [v,edge]:g[u])
      |              ^
highway.cpp: In function 'void leavesdfs(int)':
highway.cpp:67:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   67 |     for(auto [v,edge]:g[u])
      |              ^
highway.cpp:73:15: error: expected ')' before 'g'
   73 |     if(u!=root g[u].size()==1)leaves.push_back(u);
      |       ~       ^~
      |               )
highway.cpp: In function 'void goup(int, bool)':
highway.cpp:79:19: error: too few arguments to function 'void goup(int, bool)'
   79 |     goup(parent[u]);
      |                   ^
highway.cpp:75:6: note: declared here
   75 | void goup(int u,bool f)
      |      ^~~~
highway.cpp: In function 'void solve(int, int, int)':
highway.cpp:117:5: error: reference to 'ends' is ambiguous
  117 |     ends.push_back(rec(0,leaves.size()-1,cnt));
      |     ^~~~
In file included from /usr/include/c++/10/iostream:39,
                 from highway.cpp:2:
/usr/include/c++/10/ostream:693:5: note: candidates are: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::ends(std::basic_ostream<_CharT, _Traits>&)'
  693 |     ends(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
highway.cpp:17:12: note:                 'std::vector<int> ends'
   17 | vector<int>ends;
      |            ^~~~
highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:164:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  164 |     for(int i=0;i<g[root].size();i++)
      |                 ~^~~~~~~~~~~~~~~
highway.cpp:170:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  170 |     for(int i=0;i<g[root].size();i++)
      |                 ~^~~~~~~~~~~~~~~
highway.cpp:177:9: error: reference to 'ends' is ambiguous
  177 |         ends.push_back(root);
      |         ^~~~
In file included from /usr/include/c++/10/iostream:39,
                 from highway.cpp:2:
/usr/include/c++/10/ostream:693:5: note: candidates are: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::ends(std::basic_ostream<_CharT, _Traits>&)'
  693 |     ends(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
highway.cpp:17:12: note:                 'std::vector<int> ends'
   17 | vector<int>ends;
      |            ^~~~
highway.cpp:185:12: error: reference to 'ends' is ambiguous
  185 |     answer(ends[0],ends[1]);
      |            ^~~~
In file included from /usr/include/c++/10/iostream:39,
                 from highway.cpp:2:
/usr/include/c++/10/ostream:693:5: note: candidates are: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::ends(std::basic_ostream<_CharT, _Traits>&)'
  693 |     ends(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
highway.cpp:17:12: note:                 'std::vector<int> ends'
   17 | vector<int>ends;
      |            ^~~~
highway.cpp:185:20: error: reference to 'ends' is ambiguous
  185 |     answer(ends[0],ends[1]);
      |                    ^~~~
In file included from /usr/include/c++/10/iostream:39,
                 from highway.cpp:2:
/usr/include/c++/10/ostream:693:5: note: candidates are: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::ends(std::basic_ostream<_CharT, _Traits>&)'
  693 |     ends(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
highway.cpp:17:12: note:                 'std::vector<int> ends'
   17 | vector<int>ends;
      |            ^~~~