Submission #547648

# Submission time Handle Problem Language Result Execution time Memory
547648 2022-04-11T07:08:04 Z flashhh Ancient Machine (JOI21_ancient_machine) C++17
30 / 100
81 ms 10464 KB
#include <bits/stdc++.h>
#include "Anna.h"

using namespace std;

void send(char x) {
    if (x == 'X') {
        Send(0);
        Send(0);
    }
    else if (x == 'Y') {
        Send(0);
        Send(1);
    }
    else {
        Send(1);
        Send(0);
    }
}

void Anna(int n,vector<char> s) {
    for (int i=0;i<n;++i) send(s[i]);
}
#include <bits/stdc++.h>
#include "Bruno.h"
#define N 100005
#define pii pair<int,int>
#define fi first
#define se second
#define pb emplace_back
#define getbit(x,y) (((x)>>(y))&1)
#define getoff(x,y) ((x)^(1<<(y)))

using namespace std;

int n,l;
char a[N];
bool erased[N];
vector<int> s;

void Bruno(int n1,int l1,vector<int> s1) {
    n = n1; l = l1; s = s1;

    for (int i=0;i<n;++i)
        if (s[i<<1] == 0) {
            if (s[i<<1|1] == 0) a[i+1] = 'X';
            else a[i+1] = 'Y';
        }
        else a[i+1] = 'Z';

    int x = -1;
    for (int i=1;i<=n;++i)
        if (a[i] == 'X') {
            x = i;
            break;
        }

    if (x == -1) {
        for (int i=0;i<n;++i) Remove(i);
        return;
    }

    int z = x + 1;

    while (z <= n) {
        int t = z;
        while (t <= n && a[t] != 'Z') ++t;

        if (t == n + 1) {
            for (int i=z;i<t;++i) Remove(i-1);
            break;
        }

        int p = t - 1;
        while (p >= z) {
            int pos = -1; int q = p;
            while (p >= z && a[p] != 'X') --p;

            for (int i=p+1;i<=q;++i)
                if (a[i] == 'Y') {
                    pos = i;
                    break;
                }
                else Remove(i-1);

            if (pos != -1) {
                for (int i=pos+1;i<=q;++i) Remove(i-1);
                Remove(pos-1);
            }

            if (p != x && p >= z) Remove(p-1);
            --p;
        }

        Remove(t-1);
        z = t + 1;
    }

    for (int i=1;i<=x;++i) Remove(i-1);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 520 KB Output is correct
3 Correct 0 ms 512 KB Output is correct
4 Correct 0 ms 516 KB Output is correct
5 Correct 1 ms 512 KB Output is correct
6 Correct 0 ms 520 KB Output is correct
7 Correct 0 ms 512 KB Output is correct
8 Correct 0 ms 520 KB Output is correct
9 Correct 1 ms 520 KB Output is correct
10 Correct 1 ms 520 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 69 ms 10464 KB Partially correct
2 Partially correct 69 ms 10284 KB Partially correct
3 Partially correct 75 ms 10284 KB Partially correct
4 Partially correct 69 ms 10368 KB Partially correct
5 Partially correct 70 ms 10348 KB Partially correct
6 Partially correct 69 ms 10344 KB Partially correct
7 Partially correct 68 ms 10356 KB Partially correct
8 Partially correct 70 ms 10352 KB Partially correct
9 Partially correct 69 ms 10356 KB Partially correct
10 Partially correct 66 ms 10296 KB Partially correct
11 Partially correct 70 ms 10320 KB Partially correct
12 Partially correct 67 ms 10296 KB Partially correct
13 Partially correct 79 ms 10340 KB Partially correct
14 Partially correct 77 ms 10316 KB Partially correct
15 Partially correct 68 ms 10340 KB Partially correct
16 Partially correct 69 ms 10224 KB Partially correct
17 Partially correct 71 ms 10316 KB Partially correct
18 Partially correct 75 ms 10328 KB Partially correct
19 Partially correct 77 ms 10304 KB Partially correct
20 Partially correct 67 ms 10372 KB Partially correct
21 Partially correct 68 ms 10308 KB Partially correct
22 Partially correct 77 ms 10320 KB Partially correct
23 Partially correct 68 ms 10444 KB Partially correct
24 Partially correct 67 ms 10340 KB Partially correct
25 Partially correct 77 ms 10356 KB Partially correct
26 Partially correct 78 ms 10332 KB Partially correct
27 Partially correct 78 ms 10248 KB Partially correct
28 Partially correct 78 ms 10320 KB Partially correct
29 Partially correct 81 ms 10316 KB Partially correct
30 Partially correct 77 ms 10368 KB Partially correct
31 Partially correct 77 ms 10232 KB Partially correct
32 Partially correct 71 ms 10372 KB Partially correct
33 Partially correct 68 ms 10320 KB Partially correct