제출 #483379

#제출 시각아이디문제언어결과실행 시간메모리
483379DavidDamianDetecting Molecules (IOI16_molecules)C++11
69 / 100
42 ms5532 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int r, vector<int> w) { vector< pair<int, int> > elements; for(int i = 0; i < w.size(); i++){ elements.push_back({w[i], i}); } sort(elements.begin(), elements.end()); vector<int> indices; int sumEl = 0, i = 0, j = 0; while(j <= elements.size()){ if(sumEl < l){ if (j == elements.size()) break; sumEl+=elements[j++].first; }else if(sumEl > r){ sumEl-=elements[i++].first; } if(sumEl >= l && sumEl <= r) break; } if(sumEl >= l && sumEl <=r){ while(i<j) indices.push_back(elements[i++].second); } return indices; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:8:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for(int i = 0; i < w.size(); i++){
      |                    ~~^~~~~~~~~~
molecules.cpp:17:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     while(j <= elements.size()){
      |           ~~^~~~~~~~~~~~~~~~~~
molecules.cpp:19:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |             if (j == elements.size()) break;
      |                 ~~^~~~~~~~~~~~~~~~~~
#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...