제출 #346737

#제출 시각아이디문제언어결과실행 시간메모리
346737wwddDetecting Molecules (IOI16_molecules)C++14
100 / 100
59 ms8412 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pl; //gross std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<pl> wa; for(int i=0;i<w.size();i++) { wa.emplace_back(w[i],i); } sort(wa.begin(),wa.end()); int n = wa.size(); ll res = 0; int pl = 0; while(pl < wa.size() && res+wa[pl].first <= u) { res += wa[pl].first; pl++; } int pr = n-1; int rs = 0; while(pr >= n-pl && res+wa[pr].first-wa[pr-n+pl].first <= u) { res += wa[pr].first-wa[pr-n+pl].first; pr--; rs++; } vector<int> ans; if(res >= l && res <= u) { for(int i=0;i<pl-rs;i++) { ans.push_back(wa[i].second); } for(int i=0;i<rs;i++) { ans.push_back(wa[n-i-1].second); } sort(ans.begin(),ans.end()); } return ans; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:10:15: 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:17:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |  while(pl < wa.size() && res+wa[pl].first <= u) {
      |        ~~~^~~~~~~~~~~
#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...