Submission #156154

#TimeUsernameProblemLanguageResultExecution timeMemory
156154joseacazDetecting Molecules (IOI16_molecules)C++17
69 / 100
59 ms5612 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; vi find_subset ( int l, int u, vi _w ) { vector < pii > w; vi ans; for ( int i = 0; i < _w.size(); i++ ) w.push_back ( {_w[i], i} ); sort ( w.begin(), w.end() ); int rpnt = 0, sum = 0; for ( int i = 0; i < w.size(); i++ ) { for ( ; rpnt < w.size(); rpnt++ ) { if ( sum + w[rpnt].first > u ) break; sum += w[rpnt].first; } if ( sum >= l ) { ans.clear(); for ( int k = i; k < rpnt; k++ ) ans.push_back ( w[k].second ); return ans; } sum -= w[i].first; } return vi(0); }

Compilation message (stderr)

molecules.cpp: In function 'vi find_subset(int, int, vi)':
molecules.cpp:14:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for ( int i = 0; i < _w.size(); i++ )
                   ~~^~~~~~~~~~~
molecules.cpp:19:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for ( int i = 0; i < w.size(); i++ )
                   ~~^~~~~~~~~~
molecules.cpp:21:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for ( ; rpnt < w.size(); rpnt++ )
           ~~~~~^~~~~~~~~~
#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...