Submission #959279

#TimeUsernameProblemLanguageResultExecution timeMemory
959279hyakupDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; #define ll long long vector<int> find_subset(int l, int r, vector<int> w ){ vector<pair<ll, 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<ll> sv(w.size() + 1); vector<int> resp; set<pair<ll, 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] - (ll)r, -1}); if( it->first <= sv[i] - (ll)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:8:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |   for( int i = 0; i < w.size(); i++ ) v[i] = make_pair(w[i], i);
      |                   ~~^~~~~~~~~~
molecules.cpp:13:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |   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...