Submission #263156

# Submission time Handle Problem Language Result Execution time Memory
263156 2020-08-13T13:36:59 Z Basilhijaz Highway Tolls (IOI18_highway) C++11
5 / 100
142 ms 7672 KB
#include "highway.h"
#include <bits/stdc++.h>

using namespace std;

void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
  int M = U.size();
  vector<int> w(M);
  for(int i = 0; i < M; i++){
    w[i] = 0;
  }
  vector<vector<pair<int, int> > > adj(N);
  for(int i = 0; i < M; i++){
    adj[U[i]].push_back({V[i], i});
    adj[V[i]].push_back({U[i], i});
  }
  long long curr = ask(w);
  int where = 0;
  bool ok = 1;
  while(ok){
    ok = 0;
    for(int j = 0; j < adj[where].size(); j++){
        w[adj[where][j].second] = 1;
        long long last = ask(w);
        if(last != curr){
            where = adj[where][j].first;
            ok = 1;
            curr = last;
            break;
        }
    }
  }
  answer(0, where);
}

Compilation message

highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:22:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for(int j = 0; j < adj[where].size(); j++){
      |                    ~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 436 KB Output is correct
2 Correct 14 ms 1144 KB Output is correct
3 Incorrect 142 ms 7672 KB Output is incorrect: more than 100 calls to ask.
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 1024 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 1152 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 1152 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -