답안 #1088127

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1088127 2024-09-14T03:16:21 Z LucasLe Detecting Molecules (IOI16_molecules) C++17
0 / 100
0 ms 436 KB
#include "molecules.h"
#include <bits/stdc++.h>
 
using namespace std;
 
const long long INF = 1e15;
 
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
  vector<pair<long long, int>> v;
  int n = (int)w.size();
  for (int i = 0; i < n; ++i)
    v.push_back({w[i], i});
  v.push_back({INF, n});
  sort(v.begin(), v.end());
  long long pref = 0, suff = 0;
  for (int i = 0; i < n; ++i) {
    pref += v[i].first;
    suff += v[n - 1 - i].first;
    if (pref <= u && suff >= l) {
      vector<int> res;
      for (int j = i; j < n; ++j) {
        if (pref >= l) {
          for (int k = j - i; k <= j; ++k)
            res.push_back(v[k].second + 1);
          return res;
        }
        pref += v[j + 1].first - v[j - i].first;
      }
    }
  }
  return vector<int>();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 348 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 436 KB OK (n = 12, answer = NO)
4 Correct 0 ms 348 KB OK (n = 12, answer = NO)
5 Incorrect 0 ms 344 KB sum of weights should be in [290..300] but it is 301
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 348 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 348 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 348 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 348 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -