답안 #132727

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
132727 2019-07-19T11:57:22 Z dvdg6566 통행료 (IOI18_highway) C++14
0 / 100
24 ms 3824 KB
#include "highway.h"
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
#define mp make_pair
#define pb emplace_back
#define f first
#define s second
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound

vpi V[100100];
int sub[100100];
vi q;
pi par[100100];
int rt;
int blk[100100];
int ban[100100];
int ind;

int dfs(int x, int p){
	for (auto v:V[x])if (v.f!=p){
		par[v.f] = mp(x, v.s);
		dfs(v.f,x);
	}
}


void find_pair(int N, std::vector<int> U, std::vector<int> _V, int A, int B) {
  int M = U.size();
  q.resize(N-1,0);
  for (int i=0;i<M;++i){
  	int a=_V[i];
  	int b=U[i];
  	V[a].pb(b,i);
  	V[b].pb(a,i);
  }
  int len=ask(q);
  dfs(0,-1);
  for (int i=1;i<N;++i){
  	for(int j=0;j<N;++j)q[i]=0;
  	int x=i;
  	while(x){
  		q[par[x].s]=1;
  		x=par[x].f;
  	}
  	// for (int i=0;i<N-1;++i)cout<<q[i]<<' ';cout<<'\n';
  	int l = ask(q);
  	// cout<<l<<' '<<len<<'\n';
  	if (len*B == l*A){
  		answer(0,i);
  		return;
  	}
  }
}

Compilation message

highway.cpp: In function 'int dfs(int, int)':
highway.cpp:30:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 2680 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 2728 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 3824 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 2732 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 22 ms 3192 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 19 ms 3220 KB Incorrect
2 Halted 0 ms 0 KB -