Submission #996642

# Submission time Handle Problem Language Result Execution time Memory
996642 2024-06-11T03:23:29 Z hotboy2703 Ancient Machine (JOI21_ancient_machine) C++17
70 / 100
47 ms 10796 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{
    struct pt{
        ll type,l,r;
    };
}

void Anna(int N, std::vector<char> S) {
    using namespace A;
    vector <ll> a;
    for (ll i = 0;i < N;i ++){
        a.push_back(S[i]-'X');
    }
//    for (auto x:a)cout<<x<<' ';
//    cout<<'\n';
    vector <ll> res(N);
    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){
        nw.pop_back();
    }
    ll last0 = -1;
    for (ll i = 0;i < sz(nw);i ++){
        if (last0 == -1){
            if (nw[i].type == 0){res[nw[i].r] = 1;last0 = i;}
        }
        else{
            ll j = i;
            while (nw[j].type != 2)j++;
            bool ok = 0;
            for (ll k = j-1;k >= i;k --){
                if (nw[k].type==1)ok = 1;
            }
            res[nw[j].r] = 1;
            i = j;
        }
    }
//    for (auto x:res)cout<<x<<' ';
//    cout<<'\n';
    for (auto x:res)Send(x);
}
#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{
}  // namespace

void Bruno(int N, int L, std::vector<int> A) {
    using namespace B;
    vector <ll> a = A;
    vector <bool> del(N);
    ll last = -1;
    ll first = -1;
    for (ll i = 0;i < N;i ++){
        if (A[i]){
            if (first==-1)first = A[i];
            else{
                for (ll j = i - 1;j > last;j --){del[j] = 1;Remove(j);}
                del[i] = 1;Remove(i);
            }
            last = i;
        }
    }
    for (ll i = 0;i < N;i ++){
        if (!del[i]){
            Remove(i);
        }
    }
}

Compilation message

Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:47:18: warning: variable 'ok' set but not used [-Wunused-but-set-variable]
   47 |             bool ok = 0;
      |                  ^~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 780 KB Output is correct
2 Correct 0 ms 792 KB Output is correct
3 Correct 0 ms 800 KB Output is correct
4 Correct 0 ms 796 KB Output is correct
5 Correct 0 ms 784 KB Output is correct
6 Correct 0 ms 784 KB Output is correct
7 Correct 1 ms 792 KB Output is correct
8 Correct 0 ms 784 KB Output is correct
9 Correct 0 ms 796 KB Output is correct
10 Correct 0 ms 796 KB Output is correct
11 Correct 1 ms 792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 38 ms 10068 KB Partially correct
2 Partially correct 36 ms 10460 KB Partially correct
3 Partially correct 37 ms 10436 KB Partially correct
4 Partially correct 37 ms 10464 KB Partially correct
5 Partially correct 37 ms 10464 KB Partially correct
6 Partially correct 36 ms 10424 KB Partially correct
7 Partially correct 37 ms 10464 KB Partially correct
8 Partially correct 36 ms 10768 KB Partially correct
9 Partially correct 35 ms 10520 KB Partially correct
10 Partially correct 35 ms 10416 KB Partially correct
11 Partially correct 37 ms 10508 KB Partially correct
12 Partially correct 44 ms 10484 KB Partially correct
13 Partially correct 45 ms 10736 KB Partially correct
14 Partially correct 45 ms 10580 KB Partially correct
15 Partially correct 43 ms 10712 KB Partially correct
16 Partially correct 38 ms 10796 KB Partially correct
17 Partially correct 42 ms 9288 KB Partially correct
18 Partially correct 46 ms 9216 KB Partially correct
19 Partially correct 47 ms 9264 KB Partially correct
20 Partially correct 35 ms 10696 KB Partially correct
21 Partially correct 36 ms 10744 KB Partially correct
22 Partially correct 41 ms 9280 KB Partially correct
23 Partially correct 37 ms 10772 KB Partially correct
24 Partially correct 39 ms 10520 KB Partially correct
25 Partially correct 46 ms 9364 KB Partially correct
26 Partially correct 42 ms 9340 KB Partially correct
27 Partially correct 42 ms 9260 KB Partially correct
28 Partially correct 42 ms 9368 KB Partially correct
29 Partially correct 44 ms 9196 KB Partially correct
30 Partially correct 41 ms 9324 KB Partially correct
31 Partially correct 41 ms 9304 KB Partially correct
32 Partially correct 37 ms 10216 KB Partially correct
33 Partially correct 34 ms 10256 KB Partially correct