제출 #739007

#제출 시각아이디문제언어결과실행 시간메모리
739007ThylOneDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms212 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<int> prefixSum; prefixSum.push_back(0); for(int i=0;i<w.size();i++){ prefixSum.push_back(prefixSum[i]+w[i]); } vector<int> R; for(int I=0;I<w.size();I++){ if(w[I]>=l && w[I]<=u){vector<int> a = {w[I]};return a;} int left = 0; int right = I; int score = prefixSum[right+1]-prefixSum[left]; while(!(score>=l && score<=u) && left<right){ int mid = (left+right)/2; if(score>u){ left = mid; }else if(score<l){ right=mid-1; }else{ } score = prefixSum[right+1]-prefixSum[left]; } if(score>=l && score<=u){ vector<int> a; for(int i=left;i<=I;i++)a.push_back(w[i]); return a; } } return {}; }

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

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