Submission #139471

# Submission time Handle Problem Language Result Execution time Memory
139471 2019-07-31T20:12:07 Z CaroLinda Highway Tolls (IOI18_highway) C++14
5 / 100
28 ms 3032 KB
#include "highway.h"
#include <bits/stdc++.h>

#define debug printf
#define lp(i,a,b) for(int i=a;i<b;i++)
#define pii pair<int,int>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mk make_pair

const int MAXN = 9e4+ 10 ;
const int MAXM = 13e4+10 ;

using namespace std ;

struct Edge
{

	int j , id ;

	Edge(int j = 0 , int id = 0) 
		: j(j) , id(id) {}

} ;

int n , m , S , T ;

vector<int> toAsk ;

ll oldVal , newVal ;

bool marcV[MAXN] , marc[MAXM] ;

vector<Edge> adj[MAXN] ;

// --------------------------------

void dfs( int x )
{

	marcV[x] = true ;

	for(Edge e : adj[x])
		if( !marcV[e.j] && marc[e.id] )
			{ dfs(e.j) ; return ; }

	T = x ;

}

void find_pair(int N, vector<int> U, vector<int> V, int A, int B) {
  
  m = U.size();
  n = N ;

  lp(i,0,m)
  {

  		
  	int a = U[i] , b = V[i] ;

  	adj[a].pb(Edge(b,i)) ;
  	adj[b].pb(Edge(a,i)) ;

  	toAsk.pb(0) ;

  }

  ll oldVal = ask(toAsk) ;

  lp(i,0,m) 
  {
  	toAsk[i] = 1 ;

  	newVal = ask(toAsk) ;

  	toAsk[i] = 0 ;

  	if( A < B ? newVal > oldVal : newVal < oldVal ) marc[i] = true ;

  }

  dfs(0) ;

  answer(S,T) ;
  

}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2424 KB Output is correct
2 Correct 4 ms 2440 KB Output is correct
3 Correct 4 ms 2440 KB Output is correct
4 Correct 5 ms 2444 KB Output is correct
5 Correct 4 ms 2436 KB Output is correct
6 Correct 4 ms 2444 KB Output is correct
7 Correct 5 ms 2424 KB Output is correct
8 Correct 5 ms 2440 KB Output is correct
9 Correct 5 ms 2444 KB Output is correct
10 Correct 19 ms 2424 KB Output is correct
11 Correct 5 ms 2440 KB Output is correct
12 Correct 4 ms 2424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 2552 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 2936 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2424 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 3032 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 2992 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -