Submission #1029530

#TimeUsernameProblemLanguageResultExecution timeMemory
1029530nisanduuDetecting Molecules (IOI16_molecules)C++14
19 / 100
1 ms432 KiB
#include "molecules.h" #include <bits/stdc++.h> typedef long long ll; using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<ll> pref; int n = w.size(); for(ll i=0;i<n;i++){ pref.push_back(w[i]); } vector<int> ans; for(ll i=1;i<w.size();i++){ pref[i]=pref[i-1]+pref[i]; } for(ll i=0;i<w.size();i++){ ll target = i != 0 ? pref[i-1] : 0; target += l; ll ub = (target-l) + u; auto ite = lower_bound(pref.begin(),pref.end(),target); if(ite==pref.end()) continue; ll ind = ite - pref.begin(); if(pref[ind]>=target&&pref[ind]<=ub){ for(ll j=i;j<=ind;j++){ ans.push_back(j); } return ans; } } return ans; }

Compilation message (stderr)

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