제출 #96270

#제출 시각아이디문제언어결과실행 시간메모리
96270figter001Detecting Molecules (IOI16_molecules)C++14
9 / 100
2 ms504 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; typedef long long ll; const int N = 2e5+50; ll sum[N]; vector<int> find_subset(int l, int u, vector<int> w) { vector<int> ans; sort(w.begin(),w.end()); sum[0] = w[0]; for(int i=1;i<w.size();i++)sum[i] = sum[i-1] + w[i]; for(int i=0;i<w.size();i++){ int md,lo=i,hi=w.size()-1,to=-1; while(lo <= hi){ md = (lo+hi)/2; ll cur = sum[md]; if(i)cur -= sum[i-1]; if(cur >= l && cur <= u){ to = md; break; } if(cur > u)hi = md-1; else if(cur < l)lo = md+1; } if(to != -1){ for(int j=i;j<=to;j++)ans.push_back(j); break; } } return ans; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:15:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1;i<w.size();i++)sum[i] = sum[i-1] + w[i];
              ~^~~~~~~~~
molecules.cpp:16:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  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...