Submission #136469

# Submission time Handle Problem Language Result Execution time Memory
136469 2019-07-25T10:46:10 Z Nucleist Highway Tolls (IOI18_highway) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h> 
using namespace std; 
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define pb push_back
struct greateri
{
    template<class T>
    bool operator()(T const &a, T const &b) const { return a > b; }
};
int dist[90001];
vector<int>adj[90001];
bool vis[90001];
map<pair<int,int>,int>gg;
map<pair<int,int>,int>gg1;
map<int,vector<int>>gg2;
int s,t;
int s1;
int n,m;
void dfs_tree(int node)
{
	dist[node]=s1;
	gg2[s1].pb(node);
	s1+=s;
	vis[node]=1;
	for (int i = 0; i < adj[node].size(); ++i)
	{
		if(vis[adj[node][i]]!=1)
			{	gg[{adj[node][i],node}]=gg1[{min(adj[node][i],node),max(adj[node][i],node)}];
				dfs_tree(adj[node][i]);}
	}
	s1-=s;
}
void find_pair(int N,int U[], int V[], int A, int B)
{
  //flash;
	n=N;
	m=sizeof(U)/sizeof(U[0]);
	for (int i = 0; i < m; ++i)
	{
		int x,y;
		x=U[i];
		y=V[i];
		adj[x].pb(y);
		adj[y].pb(x);
		gg1[{min(x,y),max(x,y)}]=i;
	}
	s=A;
	t=B;
	s1=0;
	dfs_tree(0);
	int now[m]={0};
	int vol = ask(now[m]);
	for(auto it:gg2[vol])
	{
		auto voli = gg.lower_bound({it,-INF});
		auto kal = *voli;
		int kal1 = kal.second;
		int now[m]={0};
		now[kal1]=1;
		int ans = (__int64)(ask(now[m]));
		if(ans!=vol)
			answer(0,it);
	}
}
//code the AC sol !
// BS/queue/map

Compilation message

highway.cpp: In function 'void dfs_tree(int)':
highway.cpp:31:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < adj[node].size(); ++i)
                  ~~^~~~~~~~~~~~~~~~~~
highway.cpp: In function 'void find_pair(int, int*, int*, int, int)':
highway.cpp:43:12: warning: 'sizeof' on array function parameter 'U' will return size of 'int*' [-Wsizeof-array-argument]
  m=sizeof(U)/sizeof(U[0]);
            ^
highway.cpp:39:28: note: declared here
 void find_pair(int N,int U[], int V[], int A, int B)
                            ^
highway.cpp:58:12: error: 'ask' was not declared in this scope
  int vol = ask(now[m]);
            ^~~
highway.cpp:66:14: error: '__int64' was not declared in this scope
   int ans = (__int64)(ask(now[m]));
              ^~~~~~~
highway.cpp:66:14: note: suggested alternative: '__int64_t'
   int ans = (__int64)(ask(now[m]));
              ^~~~~~~
              __int64_t
highway.cpp:68:4: error: 'answer' was not declared in this scope
    answer(0,it);
    ^~~~~~
highway.cpp:68:4: note: suggested alternative: 'ans'
    answer(0,it);
    ^~~~~~
    ans