제출 #434613

#제출 시각아이디문제언어결과실행 시간메모리
434613ismoilov통행료 (IOI18_highway)C++14
5 / 100
264 ms12868 KiB
#include "highway.h"
#include <bits/stdc++.h>
using namespace std;

map <pair<int, int>, int> mp;
vector <int> g[90001];
vector<int> to_ask(130001);
int now;
int check(int x, int p){
    bool ok = 0;
    for(auto y : g[x]){
        if(p == y)
            continue;
        to_ask[mp[{min(x, y), max(y, x)}]] = 1;
      //  cout << x << " " << y << " " << ask(to_ask) <<" " << now << " " <<"\n";
        int noww = ask(to_ask);
        if(now == noww)
            to_ask[mp[{min(x, y), max(y, x)}]] = 0;
        else{
            now = noww;
            return check(y, x);
        }
    }
    return x;
}

void find_pair(int N, vector<int> u, vector<int> v, int a, int b) {
 int   m = u.size();
 to_ask.resize(m);
  for(int i = 0; i < m; i ++){
    g[u[i]].push_back(v[i]);
    g[v[i]].push_back(u[i]);
    mp[{min(u[i], v[i]), max(u[i], v[i])}] = i;
  }
  now = ask(to_ask);
  answer(0, check(0, 0));
}

컴파일 시 표준 에러 (stderr) 메시지

highway.cpp: In function 'int check(int, int)':
highway.cpp:10:10: warning: unused variable 'ok' [-Wunused-variable]
   10 |     bool ok = 0;
      |          ^~
#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...