제출 #240242

#제출 시각아이디문제언어결과실행 시간메모리
240242Amy313Detecting Molecules (IOI16_molecules)C++14
0 / 100
5 ms256 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<pair<int, int> >M; vector<int> A; int s, n = w.size(), c; for(int i=0; i<w.size(); i++) { M.push_back(make_pair(w[i], i+1)); } sort(M.begin(), M.end()); A.clear(); if(M[0].first>u) { return A; } for(int i=n-1; i>=0; i--) { s = M[i].first; c =0; A.push_back(M[i].second); if(s<l) { for(int j=0; j<w.size(); j++) { s+=M[j].first; A.push_back(M[j].second); if(s>=l and s<=u) { c = 1; break; } else { if(s>u) { break; } } } if(c==1) { break; } } else { if(s<=u) { break; } } } return A; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:9:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<w.size(); i++)
                  ~^~~~~~~~~
molecules.cpp:26:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int j=0; j<w.size(); j++)
                          ~^~~~~~~~~
#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...