# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1198399 | andrejikus | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 320 KiB |
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;
typedef long long ll;
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) { cerr << to_string(h); if(sizeof...(t)) cerr << ", "; DBG(t...); }
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
const int N = 1e4 + 3;
vector<int> ww;
bool cmp(const int& i, const int& j) {
return (ww[i] < ww[j]);
}
vector<int> find_subset(int l, int u, vector<int> w) {
ww = w;
vector<int> res(w.size());
iota(res.begin(), res.end(), 0);
sort(res.begin(), res.end(), cmp);
int suml = 0, sumr = 0;
for (int i = 0; i < w.size(); i++) {
int rr = w.size()-1-i;
suml += w[res[i]], sumr += w[res[rr]];
if (suml <= u && sumr >= l) {
vector<int> ans;
int t = w.size()-1, p = 0;
while (sumr > u && p < rr) {
ans.push_back(res[p++]);
sumr -= w[res[t--]];
}
for (int j = rr; j <= t; j++)
ans.push_back(res[j]);
sort(ans.begin(), ans.end());
return ans;
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |