Submission #996378

# Submission time Handle Problem Language Result Execution time Memory
996378 2024-06-10T14:15:14 Z hotboy2703 Ancient Machine (JOI21_ancient_machine) C++17
30 / 100
66 ms 11468 KB
#include "Anna.h"

#include<bits/stdc++.h>
using ll = int;
using namespace std;
#define pll pair <ll,ll>
#define fi first
#define se second
#define MP make_pair
#define sz(a) (ll((a).size()))
#define BIT(mask,i) (((mask) >> (i))&1)
#define MASK(i) (1LL << (i))

namespace A{

}

void Anna(int N, std::vector<char> S) {
    using namespace A;
    for (ll i = 0;i < N;i ++){
        Send(BIT(S[i] - 'X',0));
        Send(BIT(S[i] - 'X',1));
    }
}
#include "Bruno.h"

#include<bits/stdc++.h>
using ll = int;
using namespace std;
#define pll pair <ll,ll>
#define fi first
#define se second
#define MP make_pair
#define sz(a) (ll((a).size()))
#define BIT(mask,i) (((mask) >> (i))&1)
#define MASK(i) (1LL << (i))

namespace B{
    struct pt{
        ll type,l,r;
    };
    void del(pt x){
        for (ll i = x.l;i <= x.r;i ++)Remove(i);
    }
}  // namespace

void Bruno(int N, int L, std::vector<int> A) {
    using namespace B;
    vector <ll> a;
    for (ll i = 0;i < N;i ++){
        a.push_back(A[i*2] + A[i*2+1] * 2);
    }
    vector <pt> nw;
    for (ll i = 0;i < N;i ++){
        ll j = i;
        while (j + 1 < N && a[j+1] == a[i])j++;
        nw.push_back({a[i],i,j});
        i = j;
    }
    while (!nw.empty() && nw.back().type != 2){
        del(nw.back());
        nw.pop_back();
    }
    ll last0 = -1;
    for (ll i = 0;i < sz(nw);i ++){
        if (last0 == -1){
            if (nw[i].type == 0)last0 = i;
            else{
                del(nw[i]);
            }
        }
        else{
            ll j = i;
            while (nw[j].type != 2)j++;
            for (ll k = j - 1;k >= i;k --){
                del(nw[k]);
            }
            del(nw[j]);
            i = j;
        }
    }
    if (last0 != -1)del(nw[last0]);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 796 KB Output is correct
2 Correct 0 ms 784 KB Output is correct
3 Correct 0 ms 796 KB Output is correct
4 Correct 0 ms 872 KB Output is correct
5 Correct 1 ms 784 KB Output is correct
6 Correct 0 ms 800 KB Output is correct
7 Correct 0 ms 792 KB Output is correct
8 Correct 0 ms 796 KB Output is correct
9 Correct 1 ms 796 KB Output is correct
10 Correct 1 ms 784 KB Output is correct
11 Correct 0 ms 780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 47 ms 10772 KB Partially correct
2 Partially correct 50 ms 11468 KB Partially correct
3 Partially correct 55 ms 10900 KB Partially correct
4 Partially correct 52 ms 10624 KB Partially correct
5 Partially correct 47 ms 10968 KB Partially correct
6 Partially correct 50 ms 10688 KB Partially correct
7 Partially correct 48 ms 10700 KB Partially correct
8 Partially correct 48 ms 10736 KB Partially correct
9 Partially correct 50 ms 10940 KB Partially correct
10 Partially correct 49 ms 10908 KB Partially correct
11 Partially correct 50 ms 10624 KB Partially correct
12 Partially correct 50 ms 10860 KB Partially correct
13 Partially correct 62 ms 11268 KB Partially correct
14 Partially correct 56 ms 11124 KB Partially correct
15 Partially correct 50 ms 11120 KB Partially correct
16 Partially correct 51 ms 11120 KB Partially correct
17 Partially correct 66 ms 9988 KB Partially correct
18 Partially correct 48 ms 10036 KB Partially correct
19 Partially correct 52 ms 10088 KB Partially correct
20 Partially correct 51 ms 11056 KB Partially correct
21 Partially correct 51 ms 11128 KB Partially correct
22 Partially correct 52 ms 9828 KB Partially correct
23 Partially correct 49 ms 11032 KB Partially correct
24 Partially correct 46 ms 11068 KB Partially correct
25 Partially correct 52 ms 10096 KB Partially correct
26 Partially correct 52 ms 9896 KB Partially correct
27 Partially correct 51 ms 9992 KB Partially correct
28 Partially correct 49 ms 10060 KB Partially correct
29 Partially correct 51 ms 9976 KB Partially correct
30 Partially correct 49 ms 9892 KB Partially correct
31 Partially correct 57 ms 9856 KB Partially correct
32 Partially correct 47 ms 10628 KB Partially correct
33 Partially correct 47 ms 10792 KB Partially correct