제출 #384516

#제출 시각아이디문제언어결과실행 시간메모리
384516AlexRex0Detecting Molecules (IOI16_molecules)C++14
0 / 100
2 ms496 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> res; vector< pair<int, int> > arre; vector<int> find_subset(int l, int u, vector<int> w) { int ini = 0, fin = 0, suma = 0; for(int i = 0; i < w.size(); ++i){ arre[i].first = w[i]; arre[i].second = i; } sort(arre.begin(), arre.end()); bool encontre = false; while(fin <= arre.size()){ if(suma < l){ suma+= arre[fin].first; fin++; if(suma >= l && suma <= u){ int ind = 0; for(int i = ini; i <= fin - 1; ++i){ res[ind] = arre[i].second; ind++; } encontre = true; break; } }else{ suma-= arre[ini].first; ini++; } } if(encontre){ return res; }else{ fin--; while(ini <= fin){ suma-= arre[ini].first; ini++; if(suma >= l && suma <= u){ int ind = 0; for(int i = ini; i <= fin; ++i){ res[ind] = arre[i].second; ind++; } break; } } return res; } }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:9:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(int i = 0; i < w.size(); ++i){
      |                    ~~^~~~~~~~~~
molecules.cpp:15:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     while(fin <= arre.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...