제출 #474695

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
4746952021-09-19 12:21:40RafaelSusDetecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms204 KiB
#include <iostream>
#include <vector>
#include <algorithm>
std::vector<int> find_subset(int l, int r, std::vector<int> a){
std::sort(a.begin(), a.end());
int pl = 0;
int pr = 1;
long long sum = a[0];
bool ok = true;
while(true){
if (pl >= a.size() && pr >= a.size()){
ok = false;
break;
}
if (sum >= l and sum <= r){
break;
}else if (sum < l && pr < a.size()){
pr++;
sum += a[pr - 1];
}else if (sum < l && pr >= a.size()) {
ok = false;
break;
}else if (sum > r && pl < a.size()){
sum -= a[pl];
pl++;
}else if (sum > r && pl >= a.size()){
ok = false;
break;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:12:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |         if (pl >= a.size() && pr >= a.size()){
      |             ~~~^~~~~~~~~~~
molecules.cpp:12:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |         if (pl >= a.size() && pr >= a.size()){
      |                               ~~~^~~~~~~~~~~
molecules.cpp:18:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         }else if (sum < l && pr < a.size()){
      |                              ~~~^~~~~~~~~~
molecules.cpp:21:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         }else if (sum < l && pr >= a.size()) {
      |                              ~~~^~~~~~~~~~~
molecules.cpp:24:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         }else if (sum > r && pl < a.size()){
      |                              ~~~^~~~~~~~~~
molecules.cpp:27:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         }else if (sum > r && pl >= a.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...