제출 #997670

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

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:8:19: 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++)
      |                  ~^~~~~~~~~
#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...