Submission #259730

# Submission time Handle Problem Language Result Execution time Memory
259730 2020-08-08T12:21:55 Z lani1akea Detecting Molecules (IOI16_molecules) C++17
0 / 100
159 ms 65536 KB
#include "molecules.h"
#include <bits/stdc++.h>

#define F first
#define S second
#define ll long long
#define pb push_back
#define endl '\n'
#define rep(x) cerr<<#x<<"="<<x<<endl
#define OK cerr<<"OK"<<endl<<flush
using namespace std;

const int MOD = 1e9 + 7;
const int N = 510;

vector<int> find_subset(int l, int u, vector<int> w) {
  vector<pair<vector<int>, ll>> v;
  vector<int> ans;
  for (int i = 0; i < w.size(); ++i) {
    int x = v.size();
    for (int j = 0; j < x; ++j) {
      vector<int> up = v[j].F;
      ll sum = v[j].S;
      up.pb(i);
      sum += w[i] * 1LL;
      v.pb({up, sum});
      if (sum >= (ll)l and sum <= (ll)u) {
        ans = up;
        goto loop1;
      }
    }
    vector<int> p;
    p.pb(i);
    v.pb({p, w[i]});
  }
  loop1:
  return ans;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:19:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < w.size(); ++i) {
                   ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB OK (n = 12, answer = YES)
2 Correct 1 ms 384 KB OK (n = 12, answer = YES)
3 Correct 1 ms 640 KB OK (n = 12, answer = NO)
4 Correct 2 ms 640 KB OK (n = 12, answer = NO)
5 Correct 1 ms 256 KB OK (n = 12, answer = YES)
6 Correct 1 ms 640 KB OK (n = 12, answer = YES)
7 Correct 0 ms 384 KB OK (n = 12, answer = YES)
8 Correct 0 ms 384 KB OK (n = 12, answer = YES)
9 Correct 0 ms 256 KB OK (n = 6, answer = YES)
10 Correct 1 ms 640 KB OK (n = 12, answer = YES)
11 Runtime error 159 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -