Submission #1256307

#TimeUsernameProblemLanguageResultExecution timeMemory
1256307arafatbot144Souvenirs (IOI25_souvenirs)C++20
Compilation error
0 ms0 KiB
#include "souvenirs.h"
#include <vector>
#include <numeric>
#include <algorithm>
void buy_souvenirs(int N, long long P0) {
    std::vector<long long> P(N);
    P[0] = P0;
    for (int i = 1; i < N; ++i) {
        long long low = 1;
        long long high = P[i - 1] - 1;
        long long found_price = -1;

        while (low <= high) {
            long long mid = low + (high - low) / 2;
            auto result = transaction(mid);
            std::vector<int> bought_souvenirs = result.first;
            bool bought_item_i = false;
            for (int item_type : bought_souvenirs) {
                if (item_type == i) {
                    bought_item_i = true;
                    break;
                }
            }

            if (bought_item_i) {
                found_price = mid;
                high = mid - 1;
            } else {
                low = mid + 1;
            }
        }
        P[i] = found_price;
    }
    std::vector<int> souvenirs_to_buy(N);
    for (int i = 1; i < N; ++i) {
        souvenirs_to_buy[i] = i;
    }
    for (int i = 1; i < N; ++i) {
        for (int j = 0; j < souvenirs_to_buy[i]; ++j) {
            transaction(P[i]);
        }
    }

Compilation message (stderr)

souvenirs.cpp: In function 'void buy_souvenirs(int, long long int)':
souvenirs.cpp:42:6: error: expected '}' at end of input
   42 |     }
      |      ^
souvenirs.cpp:5:41: note: to match this '{'
    5 | void buy_souvenirs(int N, long long P0) {
      |                                         ^