# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1069075 | 2024-08-21T15:37:47 Z | quangminh412 | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 348 KB |
#include <bits/stdc++.h> using namespace std; /* John Watson https://codeforces.com/profile/quangminh98 Mua Code nhu mua Florentino !! */ #define faster() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ll long long vector<int> solve(int l, int u, vector<pair<ll, int>>& p, vector<ll>& pre, int k) { for (int i = k - 1; i < pre.size(); i++) { ll sum = pre[i] - (i - k < 0 ? 0 : pre[i - k]); if (l <= sum && sum <= u) { vector<int> ans; for (int j = i - k + 1; j <= i; j++) ans.push_back(p[j].second); return ans; } } return {}; } vector<int> find_subset(int l, int u, vector<int> w) { int n = w.size(); vector<pair<ll, int>> p; for (int i = 0; i < n; i++) p.push_back(make_pair(w[i], i)); sort(p.begin(), p.end()); vector<ll> pre(n); for (int i = 0; i < n; i++) pre[i] = (i == 0 ? 0 : pre[i - 1]) + p[i].first; for (int i = 1; i <= n; i++) { if (pre[i - 1] > u || pre[n - 1] - pre[n - i - 1] < l) continue; vector<int> ans = solve(l, u, p, pre, i); if (!ans.empty()) return ans; } return {}; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 348 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 0 ms | 348 KB | Contestant can not find answer, jury can |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | OK (n = 12, answer = YES) |
2 | Correct | 0 ms | 348 KB | OK (n = 12, answer = YES) |
3 | Correct | 0 ms | 348 KB | OK (n = 12, answer = NO) |
4 | Correct | 0 ms | 348 KB | OK (n = 12, answer = NO) |
5 | Correct | 0 ms | 348 KB | OK (n = 12, answer = YES) |
6 | Correct | 1 ms | 348 KB | OK (n = 12, answer = YES) |
7 | Correct | 0 ms | 348 KB | OK (n = 12, answer = YES) |
8 | Correct | 0 ms | 348 KB | OK (n = 12, answer = YES) |
9 | Incorrect | 1 ms | 348 KB | Contestant can not find answer, jury can |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 348 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 0 ms | 348 KB | Contestant can not find answer, jury can |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 348 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 0 ms | 348 KB | Contestant can not find answer, jury can |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 348 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 0 ms | 348 KB | Contestant can not find answer, jury can |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 348 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 0 ms | 348 KB | Contestant can not find answer, jury can |
4 | Halted | 0 ms | 0 KB | - |