제출 #632517

#제출 시각아이디문제언어결과실행 시간메모리
632517StavabDetecting Molecules (IOI16_molecules)C++14
19 / 100
1 ms288 KiB
#include "molecules.h" #include <algorithm> #include <utility> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { vector<pair<int, int>> v; for(int i = 0; i < w.size(); i++) v.push_back(make_pair(w[i], i)); sort(w.begin(), w.end()); long long sum = 0; int i, j = 0; for(i = 0; i < w.size(); i++) { sum += (long long)v[i].first; while(sum > u) { sum -= v[j].first; j++; } if(l <= sum && sum <= u) break; } if(i == w.size()) return {}; vector<int> ind; for(int z = j; z <= i; z++) ind.push_back(v[z].second); return ind; }

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

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