Submission #418299

# Submission time Handle Problem Language Result Execution time Memory
418299 2021-06-05T09:34:21 Z FlippenFaz Highway Tolls (IOI18_highway) C++11
0 / 100
14 ms 456 KB
#include "highway.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

set<int> curCities;

void find_pair(int N, vector<int> U, vector<int> V, int A, int B) {
    vector<int> askArr;
    askArr.resize(U.size());
    ll sml = ask(askArr);
    askArr[0] = 1;
    ll cur = ask(askArr);
    if (cur > sml) {
        curCities.insert(U[0]);
        curCities.insert(V[0]);
    }
    for (int i = 1; i < askArr.size(); i++) {
        U[i-1] = 0;
        U[i] = 1;
        ll cur = ask(askArr);

        if (cur > sml) {
            if (curCities.erase(U[i]) == 0) {
                curCities.insert(U[i]);
            }
            if (curCities.erase(V[i]) == 0) {
                curCities.insert(V[i]);
            }
        }
    }

    vector<int> cits;
    for (auto it = curCities.begin(); it != curCities.end(); it++) {
        cits.push_back(*it);
    }
    answer(cits[0], cits[1]);
    
}

Compilation message

highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:19:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for (int i = 1; i < askArr.size(); i++) {
      |                     ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 328 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 14 ms 456 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 14 ms 408 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 14 ms 456 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -