제출 #706458

#제출 시각아이디문제언어결과실행 시간메모리
706458finn__Detecting Molecules (IOI16_molecules)C++17
100 / 100
55 ms6208 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { vector<pair<int, int>> y; for (int i = 0; i < w.size(); i++) y.emplace_back(w[i], i); sort(y.begin(), y.end()); sort(w.begin(), w.end()); auto it = w.begin(), jt = w.begin(); long long x = 0; while (1) { if (x < l) { if (jt == w.end()) return {}; x += *jt++; } else if (x > u) x -= *it++; else { vector<int> ans; for (size_t i = it - w.begin(); i < jt - w.begin(); i++) ans.push_back(y[i].second); return ans; } } return {}; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:8:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for (int i = 0; i < w.size(); i++)
      |                     ~~^~~~~~~~~~
molecules.cpp:28:47: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type' {aka 'long int'} [-Wsign-compare]
   28 |             for (size_t i = it - w.begin(); i < jt - w.begin(); 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...