제출 #770622

#제출 시각아이디문제언어결과실행 시간메모리
770622BenmathDetecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms292 KiB
/*#include <cstdio> #include <vector> #include <cassert> */ /* #include<bits/stdc++.h> using namespace std; */ #include "molecules.h" using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { long long int sum=0; vector<int>ans; for(int i=0;i<w.size();i++){ if(w[i]<=u){ sum=sum+w[i]; ans.push_back(i); } if(sum>=l and sum<=u){ break; } } if(sum>=l and sum<=u){ return ans; }else{ ans.clear(); return ans;} } /* int main() { int n, l, u; assert(3 == scanf("%d %d %d", &n, &l, &u)); std::vector<int> w(n); for (int i = 0; i < n; i++) assert(1 == scanf("%d", &w[i])); std::vector<int> result = find_subset(l, u, w); printf("%d\n", (int)result.size()); for (int i = 0; i < (int)result.size(); i++) printf("%d%c", result[i], " \n"[i == (int)result.size() - 1]); } */

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:15:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |    for(int i=0;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...