답안 #775550

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
775550 2023-07-06T13:52:09 Z CDuong Shopping (JOI21_shopping) C++17
10 / 100
82 ms 1624 KB
#include "Anna.h"
#include <bits/stdc++.h>
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define isz(x) (int)x.size()
using namespace std;

namespace {
	int N, L, R, cur;
	int cnt, ans, max_bit;
} // namespace

void InitA(int N, int L, int R)
{
    ::N = N;
    ::L = L;
    ::R = R;
    max_bit = __lg(N);
    int anotherL = L;
    for(int i = 0; i <= max_bit; ++i) {
    	SendA(anotherL & 1);
    	anotherL >>= 1;
    }
    cnt = L;
}

void ReceiveA(bool x)
{
	if(x && cnt <= R)
		ans = cnt;
	++cnt;
}

int Answer()
{
    return ans;
}
#include "Bruno.h"
#include <bits/stdc++.h>
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define isz(x) (int)x.size()
using namespace std;

template<class T>
struct sparse_table_min {
    int n;
    vector<vector<T>> data;

    sparse_table_min() {}
    sparse_table_min(const vector<T> &a) : n(isz(a)), data({a}) {
        for(int i = 1; (1 << i) <= n; ++i) {
            data.emplace_back(n - (1 << i) + 1);
            for(int j = 0; j < isz(data[i]); ++j)
                data[i][j] = min(data[i - 1][j], data[i - 1][j + (1 << (i - 1))]);
        }
    }

    void init(const vector<T> &a) {
        n = isz(a), data = {{a}};
        for(int i = 1; (1 << i) <= n; ++i) {
            data.emplace_back(n - (1 << i) + 1);
            for(int j = 0; j < isz(data[i]); ++j)
                data[i][j] = min(data[i - 1][j], data[i - 1][j + (1 << (i - 1))]);
        }
    }

    T query(int l, int r) {
        int len = r - l + 1;
        int lg_len = 31 - __builtin_clz(len);
        return min(data[lg_len][l], data[lg_len][r - (1 << lg_len) + 1]);
    }
};

namespace {
    int N, max_bit;
    vii variable_example;
    int count, cur_bit, L;
    sparse_table_min<pii> st;

    bool FunctionExample(bool P)
    {
        return !P;
    }

} // namespace

void InitB(int N, std::vector<int> P)
{
    variable_example.resize(N);
    ::N = N, max_bit = __lg(N);
    for(int i = 0; i < N; ++i)
        variable_example[i] = pair{P[i], i};
    st.init(variable_example);
}

void cope() {
    for(int i = L; i < N; ++i)
        SendB(st.query(L, i).ss == i);
}

void ReceiveB(bool y)
{
    if(y) L ^= 1 << cur_bit;
    ++cur_bit;
    if(cur_bit > max_bit)
        cope();
}

Compilation message

Anna.cpp:18:15: warning: '{anonymous}::cur' defined but not used [-Wunused-variable]
   18 |  int N, L, R, cur;
      |               ^~~

Bruno.cpp:53:10: warning: 'bool {anonymous}::FunctionExample(bool)' defined but not used [-Wunused-function]
   53 |     bool FunctionExample(bool P)
      |          ^~~~~~~~~~~~~~~
Bruno.cpp:50:9: warning: '{anonymous}::count' defined but not used [-Wunused-variable]
   50 |     int count, cur_bit, L;
      |         ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 400 KB Output is correct
2 Correct 1 ms 400 KB Output is correct
3 Correct 0 ms 400 KB Output is correct
4 Correct 0 ms 400 KB Output is correct
5 Correct 0 ms 400 KB Output is correct
6 Correct 9 ms 528 KB Output is correct
7 Correct 8 ms 528 KB Output is correct
8 Correct 7 ms 528 KB Output is correct
9 Correct 2 ms 528 KB Output is correct
10 Correct 7 ms 528 KB Output is correct
11 Correct 9 ms 528 KB Output is correct
12 Correct 4 ms 528 KB Output is correct
13 Correct 6 ms 528 KB Output is correct
14 Correct 7 ms 528 KB Output is correct
15 Correct 4 ms 528 KB Output is correct
16 Correct 4 ms 528 KB Output is correct
17 Correct 4 ms 528 KB Output is correct
18 Correct 7 ms 528 KB Output is correct
19 Correct 4 ms 528 KB Output is correct
20 Correct 6 ms 528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 400 KB Output is correct
2 Correct 1 ms 400 KB Output is correct
3 Correct 0 ms 400 KB Output is correct
4 Correct 0 ms 400 KB Output is correct
5 Correct 0 ms 400 KB Output is correct
6 Correct 9 ms 528 KB Output is correct
7 Correct 8 ms 528 KB Output is correct
8 Correct 7 ms 528 KB Output is correct
9 Correct 2 ms 528 KB Output is correct
10 Correct 7 ms 528 KB Output is correct
11 Correct 9 ms 528 KB Output is correct
12 Correct 4 ms 528 KB Output is correct
13 Correct 6 ms 528 KB Output is correct
14 Correct 7 ms 528 KB Output is correct
15 Correct 4 ms 528 KB Output is correct
16 Correct 4 ms 528 KB Output is correct
17 Correct 4 ms 528 KB Output is correct
18 Correct 7 ms 528 KB Output is correct
19 Correct 4 ms 528 KB Output is correct
20 Correct 6 ms 528 KB Output is correct
21 Correct 41 ms 1552 KB Output is correct
22 Correct 66 ms 1552 KB Output is correct
23 Correct 49 ms 1552 KB Output is correct
24 Correct 40 ms 1600 KB Output is correct
25 Correct 39 ms 1600 KB Output is correct
26 Correct 82 ms 1552 KB Output is correct
27 Correct 20 ms 1552 KB Output is correct
28 Correct 44 ms 1612 KB Output is correct
29 Correct 76 ms 1600 KB Output is correct
30 Correct 68 ms 1624 KB Output is correct
31 Correct 17 ms 1552 KB Output is correct
32 Correct 66 ms 1616 KB Output is correct
33 Correct 31 ms 1552 KB Output is correct
34 Correct 59 ms 1552 KB Output is correct
35 Correct 6 ms 1552 KB Output is correct
36 Correct 10 ms 1552 KB Output is correct
37 Correct 73 ms 1604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Failed 0 ms 264 KB Expected integer, but "Wrong" found (Anna)
2 Halted 0 ms 0 KB -