# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
426448 | 2021-06-14T04:05:53 Z | dariasc | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 300 KB |
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> return_range(vector<pair<long long, int>> prefix, int i, int j) { vector<int> ans(j - i + 1); for (int k = 0; k < ans.size(); k++) { ans[k] = prefix[i + k].second; } return ans; } std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<pair<long long, int>> molecules(w.size()); for (int i = 0; i < w.size(); i++) { molecules[i] = {w[i], i}; } sort(molecules.begin(), molecules.end()); // make prefix sum for (int i = 1; i < molecules.size(); i++) { molecules[i].first += molecules[i-1].first; } int j = 0; for (int i = 0; i < molecules.size(); i++) { int weight = molecules[i].first; if (weight > u) { while (j < i) { int x = weight - molecules[j].first; if (l <= x && x <= u) { return return_range(molecules, j+1, i); } else if (x < l) { break; } j++; } } else if (l <= weight && weight <= u) { vector<int> ans = {i}; return ans; } } return std::vector<int>(0); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 300 KB | OK (n = 1, answer = NO) |
2 | Correct | 1 ms | 204 KB | OK (n = 1, answer = NO) |
3 | Correct | 1 ms | 204 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 1 ms | 204 KB | sum of weights should be in [100..100] but it is 50 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 296 KB | OK (n = 12, answer = YES) |
2 | Correct | 1 ms | 292 KB | OK (n = 12, answer = YES) |
3 | Correct | 1 ms | 204 KB | OK (n = 12, answer = NO) |
4 | Correct | 1 ms | 204 KB | OK (n = 12, answer = NO) |
5 | Incorrect | 1 ms | 204 KB | sum of weights should be in [290..300] but it is 50 |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 300 KB | OK (n = 1, answer = NO) |
2 | Correct | 1 ms | 204 KB | OK (n = 1, answer = NO) |
3 | Correct | 1 ms | 204 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 1 ms | 204 KB | sum of weights should be in [100..100] but it is 50 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 300 KB | OK (n = 1, answer = NO) |
2 | Correct | 1 ms | 204 KB | OK (n = 1, answer = NO) |
3 | Correct | 1 ms | 204 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 1 ms | 204 KB | sum of weights should be in [100..100] but it is 50 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 300 KB | OK (n = 1, answer = NO) |
2 | Correct | 1 ms | 204 KB | OK (n = 1, answer = NO) |
3 | Correct | 1 ms | 204 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 1 ms | 204 KB | sum of weights should be in [100..100] but it is 50 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 300 KB | OK (n = 1, answer = NO) |
2 | Correct | 1 ms | 204 KB | OK (n = 1, answer = NO) |
3 | Correct | 1 ms | 204 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 1 ms | 204 KB | sum of weights should be in [100..100] but it is 50 |
5 | Halted | 0 ms | 0 KB | - |