Submission #1306015

#TimeUsernameProblemLanguageResultExecution timeMemory
1306015not_suprised__Detecting Molecules (IOI16_molecules)C++20
Compilation error
0 ms0 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <climits>
#include <stack>
#include <map>
#include <unordered_set>
#include <cmath>
#include <iomanip>
#include <queue>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
using namespace std;
#define int long long
#define pii pair<int, int>
#define fi first
#define se second
#define all(a) begin(a), end(a)
#define pb push_back
#define nl '\n'
#define sz(x) (int)x.size()
#define in insert
#define speed ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ppb pop_back
#define ld long double
const int N = 2e5 + 10;
const int mod = 998244353;
int gcd(int a, int b) {
    if(!b) return a;
    return gcd(b, a % b);
}
const int C = 1e9 + 10;
const int INF = LLONG_MAX;
bitset<N> b;
void solve() {
    int n, l, r;
    cin >> n >> l >> r;
    vector<int> a(n);
    int need = -1;
    b[0] = 1;
    for(int i = 0; i < n; i++) cin >> a[i], b <<= a[i];
    for(int i = l; i <= r; i++) {
        if(b[i]) {
            need = i;
            break;
        }
    }
    if(need == -1) {
        cout << "-1\n";
        return;
    }
    vector<int> ans;
    for(int i = 0; i < n; i++) {
        b >>= a[i];
        if(!b[need]) {
            ans.pb(i);
            need -= a[i];
        }
    }
    for(int i : ans) cout << i << ' '; cout << nl; 
}
signed main() {
    speed;
    int T = 1;
    //cin >> T;
    for(int _ = 0; _ < T; _++)
        solve();
}
/*
4
amir rima amin nim

 */

Compilation message (stderr)

molecules.cpp:36:1: error: 'bitset' does not name a type
   36 | bitset<N> b;
      | ^~~~~~
molecules.cpp: In function 'void solve()':
molecules.cpp:42:5: error: 'b' was not declared in this scope
   42 |     b[0] = 1;
      |     ^
molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~