제출 #849640

#제출 시각아이디문제언어결과실행 시간메모리
849640Bach21Detecting Molecules (IOI16_molecules)C++14
69 / 100
35 ms5672 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { vector<pair<int,int>> w1; for (int i=0;i<w.size();i++) { w1.push_back({w[i],i}); } int sum=0; vector<int> res; sort(w1.begin(),w1.end()); for (int i=0,j=0;j<w.size();j++) { sum+=w1[j].first; while (sum>u) { sum-=w1[i].first; i++; } if (sum>=l) { for (int k=i;k<=j;k++) { res.push_back(w1[k].second); } break; } } return res; }

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

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