제출 #707566

#제출 시각아이디문제언어결과실행 시간메모리
707566Error42Detecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms288 KiB
#include "molecules.h" #include <algorithm> #include <numeric> #include <vector> using namespace std; using ll = long long; vector<int> find_subset( int const l, int const u, vector<int> _w ) { sort(_w.begin(), _w.end()); vector<ll> const w(_w.begin(), _w.end()); vector<ll> prefix(w.size() + 1); partial_sum(w.begin(), w.end(), prefix.begin() + 1); for (int mol_count = 1; mol_count <= w.size(); mol_count++) { int lo = 0; int hi = mol_count; while (lo <= hi) { int const mi = (lo + hi) / 2; int const top = mi; int const bottom = mol_count - mi; ll val = prefix[bottom] + prefix[w.size()] - prefix[w.size() - top]; if (l <= val && val <= u) { vector<int> solution; for (int i = 0; i < bottom; i++) solution.push_back(i); for (int i = w.size() - top; i < w.size(); i++) solution.push_back(i); return solution; } if (val < l) lo = mi + 1; else hi = mi - 1; } } return {}; }

컴파일 시 표준 에러 (stderr) 메시지

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