제출 #492079

#제출 시각아이디문제언어결과실행 시간메모리
492079robind3rDetecting Molecules (IOI16_molecules)C++17
0 / 100
0 ms204 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { vector<int> res; vector<pair<int, int>> sw; for(int i = 0; i < w.size(); i++){ sw.push_back({w[i], i}); } sort(sw.begin(), sw.end()); int left = 0; long long sum = 0; for(int i = 0; i < w.size(); i++){ while(left < w.size() && sum < l){ sum += sw[left].first; left++; } if(sum >= l && sum <= u){ for(int j = i; j < left; j++){ res.push_back(sw[j].second); } }else{ sum -= sw[i].first; } } return res; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:9:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(int i = 0; i < w.size(); i++){
      |                    ~~^~~~~~~~~~
molecules.cpp:18:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |  for(int i = 0; i < w.size(); i++){
      |                 ~~^~~~~~~~~~
molecules.cpp:19:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |   while(left < w.size() && sum < l){
      |         ~~~~~^~~~~~~~~~
#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...