# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1069051 | 2024-08-21T15:16:38 Z | quangminh412 | Detecting Molecules (IOI16_molecules) | C++14 | 1000 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; int i = 1, j = n; while (i != j) { int mid = i + j >> 1; vector<int> tmp = solve(l, u, p, pre, mid); if (tmp.empty()) i = j + 1; else return tmp; } 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 | 1 ms | 348 KB | OK (n = 12, answer = YES) |
2 | Correct | 0 ms | 348 KB | OK (n = 12, answer = YES) |
3 | Execution timed out | 1028 ms | 348 KB | Time limit exceeded |
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 | - |
# | 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 | - |