제출 #527028

#제출 시각아이디문제언어결과실행 시간메모리
527028lcs147Detecting Molecules (IOI16_molecules)C++98
69 / 100
38 ms4268 KiB
#include"molecules.h" #include<bits/stdc++.h> using namespace std; vector<int>find_subset(int l, int r, vector<int> w) { if(l > r) return {}; vector<int>id(w.size()); iota(id.begin(), id.end(), 0); sort(id.begin(), id.end(), [&](int a, int b){ return w[a] < w[b]; }); int i, j, sum = 0; for(i=0, j=0; j<id.size(); j++) { int ii = id[i]; int jj = id[j]; sum += w[jj]; while(sum > r) { sum -= w[ii]; i++; } if(sum >= l) break; } vector<int>res; if(sum >= l) { for(int x=i; x<=j; x++) { res.push_back(id[x]); } } sort(res.begin(), res.end()); return res; }

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

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