Submission #145075

# Submission time Handle Problem Language Result Execution time Memory
145075 2019-08-18T17:18:44 Z Nightlight Detecting Molecules (IOI16_molecules) C++14
0 / 100
2 ms 376 KB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> ans;

vector<int> find_subset(int l, int u, vector<int> w) {
  sort(w.begin(), w.end());
  int N = w.size();
  long long sum = w[0];
  int low = N-1, up = N-1;
  while((sum < l || sum > u) && up < N){
    if(low > up)break;
    while(sum < l && up >= low){
      up--;
      sum += w[up];
    }
    if(sum > u){
      sum -= w[low];
      low--;
    }
//    cout << low << " " << up << " " << sum << "\n";
  }
  if(l <= sum && sum <= u){
    for(int i = low; i <= up; i++){
      ans.push_back(w[i]);
    }
    return ans;
  }
  return vector<int>(0);
}
# 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 376 KB Contestant can not find answer, jury can
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 -