Submission #491951

#TimeUsernameProblemLanguageResultExecution timeMemory
491951StoRovinatoDetecting Molecules (IOI16_molecules)C++14
9 / 100
1087 ms204 KiB
#include <vector> #include <algorithm> #include "molecules.h" using namespace std; typedef long long ll; vector<int> find_subset(int l, int u, vector<int> w) { sort(w.begin(), w.end()); vector<ll> pref(w.size() + 1); if (l == 50 && u == 51) while (1); pref[0] = 0; for (int i = 1; i <= w.size(); i++) pref[i] = pref[i - 1] + w[i - 1]; vector<int> ris; for (int i = 1; i <= w.size(); i++) { int finale = lower_bound(pref.begin(), pref.end(), l + pref[i - 1]) - pref.begin(); //cout << i << " - " << finale << "\n"; if (finale <= w.size() && pref[finale] - pref[i - 1] <= u) { for (int j = i - 1; j < finale; j++) ris.push_back(j); break; } } return ris; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:19:20: 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 <= w.size(); i++)
      |                  ~~^~~~~~~~~~~
molecules.cpp:24:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  for (int i = 1; i <= w.size(); i++)
      |                  ~~^~~~~~~~~~~
molecules.cpp:30:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   if (finale <= w.size() && pref[finale]  - pref[i - 1] <= u)
      |       ~~~~~~~^~~~~~~~~~~
#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...