Submission #468122

#TimeUsernameProblemLanguageResultExecution timeMemory
468122TruaShamuBank (IZhO14_bank)Java
Compilation error
0 ms0 KiB
#define _crt_secure_no_warnings #include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; #define pb push_back #define all(x) begin(x), end(x) #define sz(x) (int) (x).size() using pi = pair<int,int>; #define f first #define s second #define mp make_pair void fastio() { ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); } int N, M; int A[21]; int B[21]; vi sum[20001]; vi dp[21]; int main() { fastio(); cin >> N >> M; for (int i = 0; i < N; i++) { cin >> A[i]; } for (int i = 0; i < M; i++) { cin >> B[i]; } for (int mask = 0; mask < (1 << M); ++mask) { int cur = 0; for (int i = 0; i < M; ++i) { if ((mask & (1 << i)) > 0) { cur += B[i]; } } sum[cur].pb(mask); } dp[0].pb(0); bool f = false; for (int i = 0; i < N; ++i) { bool vis = new bool[1 << 21]; f = false; for (int mask : sum[A[i]]) { for (int pmask : dp[i]) { int maskUnion = mask | pmask; if ((mask & pmask) <= 0 && !vis[&maskUnion]) { vis[&maskUnion] = true; dp[i + 1].pb(mask | pmask); f = true; } } } } cout << (f ? "YES" : "NO")<< "\n"; }

Compilation message (stderr)

bank.java:1: error: illegal character: '#'
#define _crt_secure_no_warnings
^
bank.java:2: error: illegal character: '#'
#include <bits/stdc++.h>
^
bank.java:4: error: class, interface, or enum expected
using ll = long long;
^
bank.java:5: error: class, interface, or enum expected
using vi = vector<int>;
^
bank.java:6: error: illegal character: '#'
#define pb push_back
^
bank.java:6: error: class, interface, or enum expected
#define pb push_back
        ^
bank.java:7: error: illegal character: '#'
#define all(x) begin(x), end(x)
^
bank.java:8: error: illegal character: '#'
#define sz(x) (int) (x).size()
^
bank.java:10: error: illegal character: '#'
#define f first
^
bank.java:10: error: class, interface, or enum expected
#define f first
        ^
bank.java:11: error: illegal character: '#'
#define s second
^
bank.java:12: error: illegal character: '#'
#define mp make_pair
^
bank.java:16: error: class, interface, or enum expected
    cin.tie(NULL);
    ^
bank.java:17: error: class, interface, or enum expected
    cout.tie(NULL);
    ^
bank.java:18: error: class, interface, or enum expected
}
^
bank.java:21: error: class, interface, or enum expected
int A[21];
^
bank.java:22: error: class, interface, or enum expected
int B[21];
^
bank.java:23: error: class, interface, or enum expected
vi sum[20001];
^
bank.java:24: error: class, interface, or enum expected
vi dp[21];
^
bank.java:25: error: class, interface, or enum expected
int main() {
^
bank.java:27: error: class, interface, or enum expected
    cin >> N >> M;
    ^
bank.java:28: error: class, interface, or enum expected
    for (int i = 0; i < N; i++) {
    ^
bank.java:28: error: class, interface, or enum expected
    for (int i = 0; i < N; i++) {
                    ^
bank.java:28: error: class, interface, or enum expected
    for (int i = 0; i < N; i++) {
                           ^
bank.java:30: error: class, interface, or enum expected
    }
    ^
bank.java:32: error: class, interface, or enum expected
    for (int i = 0; i < M; i++) {
                    ^
bank.java:32: error: class, interface, or enum expected
    for (int i = 0; i < M; i++) {
                           ^
bank.java:34: error: class, interface, or enum expected
    }
    ^
bank.java:36: error: class, interface, or enum expected
    for (int mask = 0; mask < (1 << M); ++mask) {
                       ^
bank.java:36: error: class, interface, or enum expected
    for (int mask = 0; mask < (1 << M); ++mask) {
                                        ^
bank.java:38: error: class, interface, or enum expected
        for (int i = 0; i < M; ++i) {
        ^
bank.java:38: error: class, interface, or enum expected
        for (int i = 0; i < M; ++i) {
                        ^
bank.java:38: error: class, interface, or enum expected
        for (int i = 0; i < M; ++i) {
                               ^
bank.java:41: error: class, interface, or enum expected
            }
            ^
bank.java:44: error: class, interface, or enum expected
    }
    ^
bank.java:47: error: class, interface, or enum expected
    bool f = false;
    ^
bank.java:48: error: class, interface, or enum expected
    for (int i = 0; i < N; ++i) {
    ^
bank.java:48: error: class, interface, or enum expected
    for (int i = 0; i < N; ++i) {
                    ^
bank.java:48: error: class, interface, or enum expected
    for (int i = 0; i < N; ++i) {
                           ^
bank.java:50: error: class, interface, or enum expected
        f = false;
        ^
bank.java:51: error: class, interface, or enum expected
        for (int mask : sum[A[i]]) {
        ^
bank.java:54: error: class, interface, or enum expected
                if ((mask & pmask) <= 0 && !vis[&maskUnion]) {
                ^
bank.java:56: error: class, interface, or enum expected
                    dp[i + 1].pb(mask | pmask);
                    ^
bank.java:57: error: class, interface, or enum expected
                    f = true;
                    ^
bank.java:58: error: class, interface, or enum expected
                }
                ^
bank.java:63: error: class, interface, or enum expected
}
^
46 errors