Submission #263156

#TimeUsernameProblemLanguageResultExecution timeMemory
263156BasilhijazHighway Tolls (IOI18_highway)C++11
5 / 100
142 ms7672 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...