Submission #1182029

#TimeUsernameProblemLanguageResultExecution timeMemory
1182029_sixtyfourAncient Machine (JOI21_ancient_machine)C++20
70 / 100
45 ms6456 KiB
#include "Anna.h"
#include <bits/stdc++.h>

using namespace std;

void Anna(int N, vector<char> S) {
    vector<int> bits(N);
    bool first_x = true;
    for(int i = 0; i < N; i++) {
        if(first_x && S[i] == 'X')
            bits[i] = 1, first_x = false;
        else if(!first_x && S[i] == 'Z')
            bits[i] = 1;
        else
            bits[i] = 0;
    }
    
    for(int i = 0; i < N; i++)
        Send(bits[i]);
}
#include "Bruno.h"
#include <bits/stdc++.h>

using namespace std;

void Bruno(int N, int L, vector<int> A) {
    int i_x = -1;
    for(int i = 0; i < N; i++) {
        if(A[i] == 1) {
            i_x = i;
            break;
        }
        Remove(i);
    }

    if(i_x == -1)
        return;
    
    int l = i_x;
    for(int i = i_x + 1; i < N; i++) {
        if(A[i] == 1) {
            int j = i - 1;
            while(j > l) {
                Remove(j);
                j--;
            }
            Remove(i);
            l = i;
        }
    }

    for(int i = l + 1; i < N; i++)
        Remove(i);
    
    Remove(i_x);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...