Submission #293664

#TimeUsernameProblemLanguageResultExecution timeMemory
293664Dovran통행료 (IOI18_highway)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "highway.h"
#define N 200009
#define pii pair <int, int>
#define ff first
#define ss second
#define pb push_back
#define ll long long

using namespace std;

int n, m, l[N], qwe;
vector<int>e[N];
vector<int>asd;
ll x;
int c[N][N];

void f(int nd, int lv){
	for(int i=0; i<e[nd].size(); i++){
		if(lv==x-1){
			ask[c[nd][i]]=1;
			int y=ask(asd);
			if(x*a!=y){
				answer(0, nd);
				qwe=1;
				return;	
			}
		}
		if(!l[e[nd][i]] and e[nd][i]>0)
			f(e[nd][i], lv+1);
		if(qwe)
			return;
	}
}

void find_pair(int NN, std::vector<int>u, std::vector<int>v, int a, int b){
	n=NN;
	m=u.size();
	for(int i=0; i<m; i++){
		e[u[i]].pb(v[i]);
		e[v[i]].pb(u[i]);
		c[v[i]][u[i]]=i;
		c[u[i]][v[i]]=i;
		
		
		asd.pb(0);
	}
	if(a>b)
		swap(a, b);
	
	x=ask(asd);
	x=x/a;
	
	f(0, 0);
}

Compilation message (stderr)

highway.cpp: In function 'void f(int, int)':
highway.cpp:19:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |  for(int i=0; i<e[nd].size(); i++){
      |               ~^~~~~~~~~~~~~
highway.cpp:21:16: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   21 |    ask[c[nd][i]]=1;
      |                ^
highway.cpp:21:17: error: assignment of read-only location '*(ask + ((sizetype)c[nd][i]))'
   21 |    ask[c[nd][i]]=1;
      |    ~~~~~~~~~~~~~^~
highway.cpp:23:9: error: 'a' was not declared in this scope
   23 |    if(x*a!=y){
      |         ^