Submission #595125

#TimeUsernameProblemLanguageResultExecution timeMemory
595125LastRoninDetecting Molecules (IOI16_molecules)C++14
100 / 100
51 ms8224 KiB
#include <bits/stdc++.h> //#include <molecules.h> #include "molecules.h" #define ll long long #define pb push_back #define pill pair<ll, ll> #define mp make_pair #define f first #define s second using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { ll n = w.size(); vector<pill> x; for(int i = 0; i < w.size(); i++) x.pb(mp(w[i], i)); sort(x.begin(), x.end()); ll sum = 0; deque<ll> zn; vector<int> ans; for(int i = 0; i < n; i++) { zn.push_back(x[i].s); sum += x[i].f; while(sum > u) { sum -= w[zn[0]]; zn.pop_front(); } if(sum >= l && sum <= u) { for(auto u : zn)ans.pb(u); return ans; } } return ans; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:15:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |  for(int 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...