제출 #742378

#제출 시각아이디문제언어결과실행 시간메모리
742378oyberDetecting Molecules (IOI16_molecules)C++14
19 / 100
1 ms288 KiB
#include "molecules.h" #include <algorithm> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { int n = int(w.size()); int a = 1000; int b = 0; for (int i = 0; i < n; i++) { a = min(a, w[i]); b = max(b, w[i]); } vector<int> ai; vector<int> bi; for (int i = 0; i < n; i++) { if (w[i] == a) ai.push_back(i); else bi.push_back(i); } for (int i = 0; i < int(ai.size())+1; i++) { for (int j = 0; j < int(bi.size())+1; j++) { int s = i*a + j*b; //printf("%d %d %d\n", i, j, s); if (s >= l && s <= u) { vector<int> result; for (int k = 0; k < i; k++) { result.push_back(ai[k]); } for (int k = 0; k < j; k++) { result.push_back(bi[k]); } return result; } } } return vector<int>(0); }
#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...