제출 #849723

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

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

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