제출 #774635

#제출 시각아이디문제언어결과실행 시간메모리
774635Sandarach151Detecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms212 KiB
#include<bits/stdc++.h> #include "molecules.h" using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { sort(w.begin(), w.end()); int pos1 = 0; int pos2 = 0; long long cursum = w[0]; vector<int> ans; bool res = true; while(true){ if(cursum<l){ pos2++; if(pos2<w.size()){ cursum+=w[pos2]; } else{ res = false; break; } } else if(cursum>u){ cursum-=w[pos1]; pos1++; if(pos1>pos2){ res = false; break; } } else{ break; } } if(res==false){ return ans; } else{ for(int i=pos1; i<=pos2; i++){ ans.push_back(w[i]); } return ans; } }

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

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