Submission #433448

#TimeUsernameProblemLanguageResultExecution timeMemory
433448bipartite_matchingDetecting Molecules (IOI16_molecules)C++14
10 / 100
1 ms204 KiB
#include <bits/stdc++.h> #define forint(i, N) for (int i = 0; i < (N); i++) using namespace std; typedef long long ll; vector<int> find_subset(int l, int u, vector<int> w) { //sort(w.begin(), w.end()); vector< pair<int, int> > v(w.size()); forint(i, w.size()) { v[i] = {w[i], i}; } sort(v.begin(), v.end()); vector<int> ans; int k = 1; int f = 0; ll sum = v[0].first; while (sum < l && k < v.size()) { sum += (ll)v[k].first; if (sum > u) { sum -= (ll)v[f].first; f++; } k++; } if (sum < l) { return ans; } else { ans.resize(k - f); for (int i = f; i < k; i++) { ans[i - f] = v[i].second; } sort(ans.begin(), ans.end()); return ans; } }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:2:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    2 | #define forint(i, N) for (int i = 0; i < (N); i++)
      |                                        ^
molecules.cpp:11:2: note: in expansion of macro 'forint'
   11 |  forint(i, w.size()) {
      |  ^~~~~~
molecules.cpp:22:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  while (sum < l && k < v.size()) {
      |                    ~~^~~~~~~~~~
#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...