Submission #259731

# Submission time Handle Problem Language Result Execution time Memory
259731 2020-08-08T12:24:35 Z lani1akea Detecting Molecules (IOI16_molecules) C++17
0 / 100
189 ms 65540 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);
    if (w[i] >= l and w[i] <= u) {
      ans = p;
      goto loop1;
    }
    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 Correct 0 ms 256 KB OK (n = 1, answer = YES)
4 Correct 0 ms 256 KB OK (n = 2, answer = YES)
5 Correct 0 ms 256 KB OK (n = 2, answer = YES)
6 Correct 0 ms 256 KB OK (n = 3, answer = YES)
7 Correct 0 ms 256 KB OK (n = 3, answer = YES)
8 Correct 0 ms 256 KB OK (n = 3, answer = YES)
9 Correct 1 ms 256 KB OK (n = 3, answer = YES)
10 Correct 0 ms 256 KB OK (n = 3, answer = YES)
11 Correct 0 ms 256 KB OK (n = 3, answer = YES)
12 Correct 0 ms 256 KB OK (n = 3, answer = YES)
13 Correct 0 ms 256 KB OK (n = 3, answer = NO)
14 Correct 0 ms 256 KB OK (n = 3, answer = YES)
15 Correct 1 ms 256 KB OK (n = 3, answer = YES)
16 Correct 1 ms 256 KB OK (n = 3, answer = NO)
17 Correct 1 ms 384 KB OK (n = 3, answer = NO)
18 Runtime error 189 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 12, answer = YES)
2 Correct 1 ms 288 KB OK (n = 12, answer = YES)
3 Correct 2 ms 640 KB OK (n = 12, answer = NO)
4 Correct 1 ms 544 KB OK (n = 12, answer = NO)
5 Correct 0 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 1 ms 256 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 161 ms 65540 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 Correct 0 ms 256 KB OK (n = 1, answer = YES)
4 Correct 0 ms 256 KB OK (n = 2, answer = YES)
5 Correct 0 ms 256 KB OK (n = 2, answer = YES)
6 Correct 0 ms 256 KB OK (n = 3, answer = YES)
7 Correct 0 ms 256 KB OK (n = 3, answer = YES)
8 Correct 0 ms 256 KB OK (n = 3, answer = YES)
9 Correct 1 ms 256 KB OK (n = 3, answer = YES)
10 Correct 0 ms 256 KB OK (n = 3, answer = YES)
11 Correct 0 ms 256 KB OK (n = 3, answer = YES)
12 Correct 0 ms 256 KB OK (n = 3, answer = YES)
13 Correct 0 ms 256 KB OK (n = 3, answer = NO)
14 Correct 0 ms 256 KB OK (n = 3, answer = YES)
15 Correct 1 ms 256 KB OK (n = 3, answer = YES)
16 Correct 1 ms 256 KB OK (n = 3, answer = NO)
17 Correct 1 ms 384 KB OK (n = 3, answer = NO)
18 Runtime error 189 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
19 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 Correct 0 ms 256 KB OK (n = 1, answer = YES)
4 Correct 0 ms 256 KB OK (n = 2, answer = YES)
5 Correct 0 ms 256 KB OK (n = 2, answer = YES)
6 Correct 0 ms 256 KB OK (n = 3, answer = YES)
7 Correct 0 ms 256 KB OK (n = 3, answer = YES)
8 Correct 0 ms 256 KB OK (n = 3, answer = YES)
9 Correct 1 ms 256 KB OK (n = 3, answer = YES)
10 Correct 0 ms 256 KB OK (n = 3, answer = YES)
11 Correct 0 ms 256 KB OK (n = 3, answer = YES)
12 Correct 0 ms 256 KB OK (n = 3, answer = YES)
13 Correct 0 ms 256 KB OK (n = 3, answer = NO)
14 Correct 0 ms 256 KB OK (n = 3, answer = YES)
15 Correct 1 ms 256 KB OK (n = 3, answer = YES)
16 Correct 1 ms 256 KB OK (n = 3, answer = NO)
17 Correct 1 ms 384 KB OK (n = 3, answer = NO)
18 Runtime error 189 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
19 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 Correct 0 ms 256 KB OK (n = 1, answer = YES)
4 Correct 0 ms 256 KB OK (n = 2, answer = YES)
5 Correct 0 ms 256 KB OK (n = 2, answer = YES)
6 Correct 0 ms 256 KB OK (n = 3, answer = YES)
7 Correct 0 ms 256 KB OK (n = 3, answer = YES)
8 Correct 0 ms 256 KB OK (n = 3, answer = YES)
9 Correct 1 ms 256 KB OK (n = 3, answer = YES)
10 Correct 0 ms 256 KB OK (n = 3, answer = YES)
11 Correct 0 ms 256 KB OK (n = 3, answer = YES)
12 Correct 0 ms 256 KB OK (n = 3, answer = YES)
13 Correct 0 ms 256 KB OK (n = 3, answer = NO)
14 Correct 0 ms 256 KB OK (n = 3, answer = YES)
15 Correct 1 ms 256 KB OK (n = 3, answer = YES)
16 Correct 1 ms 256 KB OK (n = 3, answer = NO)
17 Correct 1 ms 384 KB OK (n = 3, answer = NO)
18 Runtime error 189 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
19 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 Correct 0 ms 256 KB OK (n = 1, answer = YES)
4 Correct 0 ms 256 KB OK (n = 2, answer = YES)
5 Correct 0 ms 256 KB OK (n = 2, answer = YES)
6 Correct 0 ms 256 KB OK (n = 3, answer = YES)
7 Correct 0 ms 256 KB OK (n = 3, answer = YES)
8 Correct 0 ms 256 KB OK (n = 3, answer = YES)
9 Correct 1 ms 256 KB OK (n = 3, answer = YES)
10 Correct 0 ms 256 KB OK (n = 3, answer = YES)
11 Correct 0 ms 256 KB OK (n = 3, answer = YES)
12 Correct 0 ms 256 KB OK (n = 3, answer = YES)
13 Correct 0 ms 256 KB OK (n = 3, answer = NO)
14 Correct 0 ms 256 KB OK (n = 3, answer = YES)
15 Correct 1 ms 256 KB OK (n = 3, answer = YES)
16 Correct 1 ms 256 KB OK (n = 3, answer = NO)
17 Correct 1 ms 384 KB OK (n = 3, answer = NO)
18 Runtime error 189 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
19 Halted 0 ms 0 KB -