제출 #751067

#제출 시각아이디문제언어결과실행 시간메모리
751067KN200711Detecting Molecules (IOI16_molecules)C++14
19 / 100
1 ms212 KiB
#include "molecules.h" # include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { int ans = 0; vector< pair<int, int> > w1(w.size()); for(int k=0;k<w.size();k++) { w1[k].first = w[k]; w1[k].second = k; } sort(w1.begin(), w1.end()); vector<int> sp; sp.clear(); for(int k=0;k<w1.size();k++) { if(ans + w1[k].first <= u) { ans += w1[k].first; sp.push_back(w1[k].second); } } if(ans >= l) return sp; int V1 = sp.size() - 1, W = w.size() - 1; while(ans < l && V1 >= 0 && W >= 0) { ans += w1[W].first - w1[sp[V1]].first; sp[V1] = w1[W].second; V1--; W--; } if(ans >= l) return sp; sp.clear(); return sp; }

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

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