Submission #959277

#TimeUsernameProblemLanguageResultExecution timeMemory
959277hyakupDetecting Molecules (IOI16_molecules)C++17
46 / 100
4 ms1116 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; vector<int> find_subset(int l, int r, vector<int> w ){ vector<pair<int, int>> v( w.size() ); for( int i = 0; i < w.size(); i++ ) v[i] = make_pair(w[i], i); sort( v.begin(), v.end()); vector<int> sv(w.size() + 1), resp; set<pair<int, int>> s; s.insert({0, 0}); for( int i = 1; i <= sv.size(); i++ ){ sv[i] = sv[i - 1] + v[i - 1].first; s.insert({ sv[i], i }); auto it = s.lower_bound({ sv[i] - r, -1}); if( it->first <= sv[i] - l ){ for( int j = it->second; j < i; j++ ) resp.push_back(v[j].second); break; } } return resp; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:7:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |   for( int i = 0; i < w.size(); i++ ) v[i] = make_pair(w[i], i);
      |                   ~~^~~~~~~~~~
molecules.cpp:11:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |   for( int i = 1; i <= sv.size(); i++ ){
      |                   ~~^~~~~~~~~~~~
#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...