# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
138955 | 2019-07-31T03:27:06 Z | SirCeness | Detecting Molecules (IOI16_molecules) | C++14 | 2 ms | 256 KB |
#include "molecules.h" #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define inside sl<=l&&r<=sr #define outside r<sl||sr<l #define orta ((l+r)>>1) #define INF 1000000009 #define mod 1000000007 #define ppair(x); cerr << "(" << x.first << ", " << x.second << ")\n"; #define bas(x) #x << ": " << x << " " #define prarr(x, n); cerr << #x << ": "; for(int qsd = 0; qsd < n; qsd++) cerr << x[qsd] << " "; cerr << "\n"; #define prarrv(x); cerr << #x << ": "; for(int qsd = 0; qsd < (int)x.size(); qsd++) cerr << x[qsd] << " "; cerr << "\n"; using namespace std; typedef long long ll; vector<int> find_subset(int l, int u, vector<int> w) { int anssize = -1; ll pre = 0, suf = 0; ll top = 0; sort(w.begin(), w.end()); for (int i = 0; i < w.size(); i++){ pre += w[i]; suf += w[w.size()-i-1]; // cout << bas(i) << bas(pre) << bas(suf) << endl; if (pre <= u && l <= suf){ anssize = i+1; top = pre; break; } } vector<int> ans(0); if (anssize == -1) return ans; ans.resize(anssize); for (int i = 0; i < ans.size(); i++) ans[i] = w[i]; int ind = 0; while (top < l){ ans[ind] = w[w.size()-ind-1]; top += w[w.size()-ind-1] - w[ind]; ind++; } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 2 ms | 256 KB | Integer 10 violates the range [0, 0] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Integer 51 violates the range [0, 11] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 2 ms | 256 KB | Integer 10 violates the range [0, 0] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 2 ms | 256 KB | Integer 10 violates the range [0, 0] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 2 ms | 256 KB | Integer 10 violates the range [0, 0] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 2 ms | 256 KB | Integer 10 violates the range [0, 0] |
4 | Halted | 0 ms | 0 KB | - |