Submission #1060171

# Submission time Handle Problem Language Result Execution time Memory
1060171 2024-08-15T11:15:57 Z RecursiveCo Ancient Machine 2 (JOI23_ancient2) C++17
10 / 100
87 ms 1484 KB
// CF template, version 3.0

#include <bits/stdc++.h>
#include "ancient2.h"

using namespace std;

#define improvePerformance ios_base::sync_with_stdio(false); cin.tie(0)
#define getTest int t; cin >> t
#define eachTest for (int _var=0;_var<t;_var++)
#define get(name) int (name); cin >> (name)
#define out(o) cout << (o)
#define getList(cnt, name) vector<int> (name); for (int _=0;_<(cnt);_++) { get(a); (name).push_back(a); }
#define sortl(name) sort((name).begin(), (name).end())
#define rev(name) reverse((name).begin(), (name).end())
#define forto(name, var) for (int (var) = 0; (var) < (name); (var)++)
#define decision(b) if (b){out("YES");}else{out("NO");}

//#define int long long int

template <typename T, typename I>
struct segtree {
    int n;
    vector<T> tree;
    vector<I> initial;
    T id;

    segtree(int i_n, vector<I> i_initial, T i_id): n(i_n), initial(i_initial), id(i_id) {
        tree.resize(4 * n);
    }

    T conquer(T left, T right) {
        // write your conquer function
    }

    T value(I inp) {
        // write your value function
    }

    void build(int v, int l, int r) {
        if (l == r) tree[v] = value(initial[l]);
        else {
            int middle = (l + r) / 2;
            build(2 * v, l, middle);
            build(2 * v + 1, middle + 1, r);
            tree[v] = conquer(tree[2 * v], tree[2 * v + 1]);
        }
    }

    void upd(int v, int l, int r, int i, I x) {
        if (l == r) tree[v] = value(x);
        else {
            int middle = (l + r) / 2;
            if (middle >= i) upd(2 * v, l, middle, i, x);
            else upd(2 * v + 1, middle + 1, r, i, x);
            tree[v] = conquer(tree[2 * v], tree[2 * v + 1]);
        }
    }

    T query(int v, int l, int r, int ql, int qr) {
        if (ql <= l && r <= qr) return tree[v];
        else if (r < ql || qr < l) return id;
        int middle = (l + r) / 2;
        T left = query(2 * v, l, middle, ql, qr);
        T right = query(2 * v + 1, middle + 1, r, ql, qr);
        return conquer(left, right);
    }
};

// vector<int>

string Solve(int N) {
    string ans = "";
    forto(N, i) {
        vector<int> A;
        vector<int> B;
        forto(i, j) A.push_back(j + 1), B.push_back(j + 1);
        A.push_back(i + 1);
        B.push_back(i + 2);
        A.push_back(i + 1);
        B.push_back(i + 1);
        A.push_back(i + 2);
        B.push_back(i + 2);
        int m = A.size(); // = B.size()
        int res = Query(m, A, B);
        if (res == i + 1) ans += "0";
        else ans += "1";
    }
    return ans;
}

Compilation message

ancient2.cpp: In function 'std::string Solve(int)':
ancient2.cpp:16:35: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   16 | #define forto(name, var) for (int (var) = 0; (var) < (name); (var)++)
      |                                   ^
ancient2.cpp:74:5: note: in expansion of macro 'forto'
   74 |     forto(N, i) {
      |     ^~~~~
ancient2.cpp:16:35: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   16 | #define forto(name, var) for (int (var) = 0; (var) < (name); (var)++)
      |                                   ^
ancient2.cpp:77:9: note: in expansion of macro 'forto'
   77 |         forto(i, j) A.push_back(j + 1), B.push_back(j + 1);
      |         ^~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 62 ms 744 KB Output is partially correct
2 Partially correct 58 ms 744 KB Output is partially correct
3 Partially correct 59 ms 752 KB Output is partially correct
4 Partially correct 61 ms 652 KB Output is partially correct
5 Partially correct 56 ms 496 KB Output is partially correct
6 Partially correct 70 ms 512 KB Output is partially correct
7 Partially correct 71 ms 500 KB Output is partially correct
8 Partially correct 75 ms 708 KB Output is partially correct
9 Partially correct 72 ms 500 KB Output is partially correct
10 Partially correct 87 ms 712 KB Output is partially correct
11 Partially correct 62 ms 828 KB Output is partially correct
12 Partially correct 63 ms 696 KB Output is partially correct
13 Partially correct 80 ms 676 KB Output is partially correct
14 Partially correct 61 ms 500 KB Output is partially correct
15 Partially correct 76 ms 748 KB Output is partially correct
16 Partially correct 56 ms 600 KB Output is partially correct
17 Partially correct 55 ms 492 KB Output is partially correct
18 Partially correct 76 ms 344 KB Output is partially correct
19 Partially correct 64 ms 492 KB Output is partially correct
20 Partially correct 69 ms 744 KB Output is partially correct
21 Partially correct 59 ms 916 KB Output is partially correct
22 Partially correct 78 ms 500 KB Output is partially correct
23 Partially correct 56 ms 500 KB Output is partially correct
24 Partially correct 73 ms 344 KB Output is partially correct
25 Partially correct 72 ms 616 KB Output is partially correct
26 Partially correct 57 ms 496 KB Output is partially correct
27 Partially correct 60 ms 492 KB Output is partially correct
28 Partially correct 57 ms 676 KB Output is partially correct
29 Partially correct 57 ms 488 KB Output is partially correct
30 Partially correct 56 ms 632 KB Output is partially correct
31 Partially correct 55 ms 344 KB Output is partially correct
32 Partially correct 83 ms 600 KB Output is partially correct
33 Partially correct 61 ms 600 KB Output is partially correct
34 Partially correct 56 ms 500 KB Output is partially correct
35 Partially correct 58 ms 496 KB Output is partially correct
36 Partially correct 68 ms 508 KB Output is partially correct
37 Partially correct 66 ms 500 KB Output is partially correct
38 Partially correct 55 ms 600 KB Output is partially correct
39 Partially correct 56 ms 472 KB Output is partially correct
40 Partially correct 75 ms 512 KB Output is partially correct
41 Partially correct 55 ms 492 KB Output is partially correct
42 Partially correct 59 ms 516 KB Output is partially correct
43 Partially correct 57 ms 496 KB Output is partially correct
44 Partially correct 84 ms 756 KB Output is partially correct
45 Partially correct 72 ms 540 KB Output is partially correct
46 Partially correct 60 ms 508 KB Output is partially correct
47 Partially correct 58 ms 344 KB Output is partially correct
48 Partially correct 55 ms 496 KB Output is partially correct
49 Partially correct 64 ms 600 KB Output is partially correct
50 Partially correct 75 ms 864 KB Output is partially correct
51 Partially correct 55 ms 600 KB Output is partially correct
52 Partially correct 56 ms 508 KB Output is partially correct
53 Partially correct 56 ms 744 KB Output is partially correct
54 Partially correct 65 ms 984 KB Output is partially correct
55 Partially correct 60 ms 712 KB Output is partially correct
56 Partially correct 56 ms 492 KB Output is partially correct
57 Partially correct 75 ms 496 KB Output is partially correct
58 Partially correct 59 ms 1484 KB Output is partially correct
59 Partially correct 56 ms 600 KB Output is partially correct
60 Partially correct 58 ms 688 KB Output is partially correct
61 Partially correct 65 ms 496 KB Output is partially correct
62 Partially correct 68 ms 672 KB Output is partially correct
63 Partially correct 61 ms 500 KB Output is partially correct