Submission #589251

#TimeUsernameProblemLanguageResultExecution timeMemory
589251shrimbDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #include "molecules.h" using namespace std; std::vector<int> find_subset(int L, int U, std::vector<int> W) { long long l = L; long long u = U; vector<long long> w = W; int n = w.size(); pair<int,int> v[n]; for (int i = 0 ; i < n ; i++) { v[i] = {w[i], i}; } sort(v, v + n); set<pair<long long,int>> s = {{0,0}}; long long sm = 0; vector<int> ret; for (int i = 0 ; i < n ; i++) { sm += v[i].first; s.insert({sm, i + 1}); auto it = s.lower_bound({sm - u, -INT_MAX}); if (it != s.end()) { if (sm - it -> first >= l and sm - it -> first <= u) { for (int j = it -> second ; j <= i ; j++) { ret.push_back(v[j].second); } return ret; } } } return {}; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:9:27: error: conversion from 'vector<int>' to non-scalar type 'vector<long long int>' requested
    9 |     vector<long long> w = W;
      |                           ^