제출 #810801

#제출 시각아이디문제언어결과실행 시간메모리
810801wortelwormDetecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms300 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; std::vector<int> find_subset(int lower, int upper, std::vector<int> wOriginal) { ll sum = 0; // size, index vector<pair<int, int>> weights(wOriginal.size()); for (int i = 0; i < wOriginal.size(); i++) { weights[i] = {wOriginal[i], i}; } sort(weights.rbegin(), weights.rend()); vector<int> answer; for (int i = 0; i < weights.size(); i++) { auto [w, index] = weights[i]; sum += w; answer.push_back(index); if (sum >= lower) { if (sum > upper) { return {}; } return answer; } } return {}; }

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

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