Submission #974790

#TimeUsernameProblemLanguageResultExecution timeMemory
974790d4xnDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define int long long vector<int> sb; std::vector<signed> find_subset(int l, int u, std::vector<int> w) { int n = w.size(); int sum = 0; int R = -1; while (R+1 < n && sum + w[R+1] <= u) { sum += w[++R]; sb.push_back(R); } if (l <= sum) return sb; int L = n; while (min(R, L-1) >= 0 && sum - w[R] + w[L-1] <= u) { sum += w[--L] - w[R--]; sb.pop_back(); } for (int i = n-1; i >= L; i++) { sb.push_back(i); } if (sum < l || u < sum) sb.clear(); return sb; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(long long int, long long int, std::vector<long long int>)':
molecules.cpp:19:25: error: could not convert 'sb' from 'vector<long long int>' to 'vector<int>'
   19 |    if (l <= sum) return sb;
      |                         ^~
      |                         |
      |                         vector<long long int>
molecules.cpp:32:12: error: could not convert 'sb' from 'vector<long long int>' to 'vector<int>'
   32 |     return sb;
      |            ^~
      |            |
      |            vector<long long int>