Submission #132932

#TimeUsernameProblemLanguageResultExecution timeMemory
132932wzyDetecting Molecules (IOI16_molecules)C++11
100 / 100
66 ms6380 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define pii pair<int,int> std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<pii> v; for(int i = 0 ; i < w.size() ; i ++) v.push_back({w[i] , i}); sort(v.begin() , v.end()); int lx = 0 ; long long curr = 0; for(int i = 0 ; i < w.size(); i ++){ curr += (long long) v[i].first; while(curr > (long long)u && lx != (i)){ curr -= (long long) v[lx].first; lx++; } if(curr <= (long long) u && curr >= (long long)l){ vector<int> p ; for(int j = lx ; j <= i ; j ++){ p.push_back(v[j].second); } return p; } } return vector<int>(); }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:7:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0 ; i < w.size() ; i ++) v.push_back({w[i] , i});
                  ~~^~~~~~~~~~
molecules.cpp:11:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  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...