제출 #472844

#제출 시각아이디문제언어결과실행 시간메모리
472844Erik_GepardDetecting Molecules (IOI16_molecules)C++14
19 / 100
1 ms296 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; std::vector<int> find_subset(int ll, int uu, std::vector<int> w) { long long n=w.size(); long long l=ll; long long u=uu; vector<pair<long long, long long> > a(w.size()); for(long long i=0; i<w.size(); i++){ a[i].first=w[i]; a[i].second=i; } sort(a.begin(), a.end()); long long sum=0; long long j=0; long long helyesi=-1, helyesj=-1; for(long long i=0; i<n; i++){ while(sum<l && j<n){ sum+=w[j]; j++; } if(sum<=u && sum>=l){ helyesi=i; helyesj=j; } sum-=a[i].first; } vector<int> ans; for(long long i=helyesi; i<helyesj; i++){ ans.push_back(a[i].second); } if(helyesi!=-1) return ans; else return vector<int>(0); }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:11:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(long long 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...