제출 #93472

#제출 시각아이디문제언어결과실행 시간메모리
93472tpoppoDetecting Molecules (IOI16_molecules)C++14
100 / 100
52 ms7164 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<ll,int>; vector<int> res; vector<pii> v; vector<int> find_subset(int lw, int u, vector<int> w) { v.reserve(w.size()); for(int i=0;i<w.size();i++){ v.emplace_back(w[i],i); } sort(v.begin(),v.end()); int l = 0; ll sum = 0; for(int r = 0;r < v.size();r++){ sum += v[r].first; while(sum > u){ sum -= v[l].first; l++; } //cout<<l<<" - "<<r<<": "<<sum<<endl; if(sum >= lw){ for(int i = l;i<=r;i++) res.push_back(v[i].second); return res; } } return vector<int>(); }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:15:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<w.size();i++){
               ~^~~~~~~~~
molecules.cpp:22:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int r = 0;r < v.size();r++){
                 ~~^~~~~~~~~~
#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...