Submission #292309

# Submission time Handle Problem Language Result Execution time Memory
292309 2020-09-06T19:30:19 Z kimbj0709 Highway Tolls (IOI18_highway) C++14
5 / 100
15 ms 888 KB
#include "highway.h"
#include<bits/stdc++.h>
using namespace std;
#define maxn 1050
#define f first
#define s second
int a,b;
int dist = 0;
//long long ask(const std::vector<int> &w);
//void answer(int s, int t);
vector<vector<pair<int,int> > > adj(maxn);
vector<int> visited;
int cnt = 0;
void dfs(int node,int parent,int dis){
  if(dis==dist){
    if(ask(visited)==cnt*b){
      assert(dist==cnt);
     // cout << node << "--\n";
      answer(0,node);
      exit(0);
    }
  }
  for(auto k:adj[node]){
    if(k.f!=parent){
      visited[k.s] = 1;
      cnt++;
      dfs(k.f,node,dis+1);
      visited[k.s] = 0;
      cnt--;
    }
  }
}
void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
  int M = U.size();
  for(int i=0;i<M;i++){
    adj[U[i]].push_back({V[i],i});
    adj[V[i]].push_back({U[i],i});
  }
  for(int i=0;i<M;i++){
    visited.push_back(0);
  }
  a = A;
  b = B;
  assert(ask(visited)%a==0);
  dist = ask(visited)/a;
  dfs(0,-1,0);
  assert(0==1);
 
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Runtime error 10 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 14 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 Incorrect 3 ms 384 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 15 ms 768 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 11 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -