제출 #599816

#제출 시각아이디문제언어결과실행 시간메모리
599816cheissmartDetecting Molecules (IOI16_molecules)C++14
9 / 100
0 ms212 KiB
#include "molecules.h" #include <bits/stdc++.h> #define F first #define S second #define V vector #define PB push_back #define EB emplace_back #define MP make_pair #define SZ(v) int((v).size()) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef V<int> vi; const int INF = 1e9 + 7; vi find_subset(int l, int r, vi w) { V<pi> tt; for(int i = 0; i < SZ(w); i++) tt.EB(w[i], i); sort(ALL(tt), greater<pi>()); vi ans; ll sum = 0; for(int i = 0; i < SZ(w); i++) { sum += tt[i].F; if(l <= sum && sum <= r) { for(int j = 0; j <= i; j++) ans.PB(tt[j].S); break; } } if(ans.empty()) { sort(ALL(tt), less<pi>()); ll sum = 0; for(int i = 0; i < SZ(w); i++) { sum += tt[i].F; if(l <= sum && sum <= r) { for(int j = 0; j <= i; j++) ans.PB(tt[j].S); break; } } } sort(ALL(ans)); return ans; }
#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...