Submission #129908

# Submission time Handle Problem Language Result Execution time Memory
129908 2019-07-13T13:35:28 Z Boxworld Highway Tolls (IOI18_highway) C++14
5 / 100
29 ms 912 KB
#include "highway.h"
#include <bits/stdc++.h>
using namespace std;
int useless[110],ans;
vector<int> G[110],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++)
               ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 248 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 296 KB Output is correct
5 Correct 3 ms 248 KB Output is correct
6 Correct 3 ms 248 KB Output is correct
7 Correct 3 ms 248 KB Output is correct
8 Correct 3 ms 248 KB Output is correct
9 Correct 3 ms 248 KB Output is correct
10 Correct 3 ms 276 KB Output is correct
11 Correct 2 ms 248 KB Output is correct
12 Correct 4 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 17 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 29 ms 912 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 21 ms 904 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -