답안 #136580

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
136580 2019-07-25T15:46:59 Z Boxworld 통행료 (IOI18_highway) C++14
5 / 100
38 ms 3320 KB
#include "highway.h"
#include <bits/stdc++.h>
using namespace std;
int useless[90010],ans;
vector<int> G[90010],u,v;
void dfs(int p){
	int ok=0;
	for (int i=0;i<G[p].size();i++)
	if (!useless[G[p][i]]){
		int rd=G[p][i];ok=1;
		useless[G[p][i]]=1;
		if (p==u[rd])dfs(v[rd]);else dfs(u[rd]);
	}
	if (ok==0)ans=p;
}
void find_pair(int N,std::vector<int> U,std::vector<int> V,int A,int B) {
	int M=U.size();
	u=U;v=V;
	memset(useless,0,sizeof(useless));
	for (int i=0;i<M;i++){
		G[u[i]].push_back(i);
		G[v[i]].push_back(i);
	}
	vector<int> w(M);
    for (int i=0;i<M;i++)w[i]=0;
    long long dist=ask(w);
    for (int i=0;i<M;i++){
    	w[i]=1;
    	long long dis=ask(w);
    	if (dist==dis)useless[i]=1;
    	w[i]=0;
	}
	dfs(0);
	answer(0,ans);
}

Compilation message

highway.cpp: In function 'void dfs(int)':
highway.cpp:8:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i=0;i<G[p].size();i++)
               ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 5 ms 2936 KB Output is correct
3 Correct 5 ms 2684 KB Output is correct
4 Correct 5 ms 2680 KB Output is correct
5 Correct 5 ms 2680 KB Output is correct
6 Correct 6 ms 2812 KB Output is correct
7 Correct 6 ms 2808 KB Output is correct
8 Correct 6 ms 2808 KB Output is correct
9 Correct 5 ms 2680 KB Output is correct
10 Correct 5 ms 2852 KB Output is correct
11 Correct 5 ms 2808 KB Output is correct
12 Correct 5 ms 2680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 2808 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 3280 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 2936 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 3320 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 38 ms 3288 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -