Submission #426538

# Submission time Handle Problem Language Result Execution time Memory
426538 2021-06-14T06:10:19 Z 반딧불(#7615) Ancient Machine (JOI21_ancient_machine) C++17
30 / 100
113 ms 9728 KB
#include "Anna.h"
#include <bits/stdc++.h>

using namespace std;

namespace {
    int n;
}

void Anna(int N, vector<char> S) {
    n = N;
    char need = 'X';
    for(int i=0; i<n; i++){
        int tmp = S[i] - 'X';
        Send(tmp/2);
        Send(tmp%2);
    }
}
#include "Bruno.h"
#include <bits/stdc++.h>

using namespace std;

namespace {
    int n;
    int arr[100002];
    vector<int> X, Z;
}  // namespace

void Bruno(int N, int L, vector<int> A) {
    n = N;
    for(int i=0; i<n; i++){
        arr[i] = A[i*2] * 2 + A[i*2+1];
    }
    for(int i=0; i<n; i++){
        if(arr[i] == 2) Z.push_back(i);
    }
    reverse(Z.begin(), Z.end());

    int xOpen = -1;
    for(int i=0; i<n; i++){
        if(xOpen == -1){
            if(arr[i]) Remove(i);
            else{
                xOpen = i;
            }
            continue;
        }

        if(arr[i] == 2){
            Remove(i);
            continue;
        }
        int j = i;
        while(j+1<n && arr[j+1]!=2) j++;
        for(int k=j; k>=i; k--) Remove(k);
        i=j;
    }
    if(xOpen != -1) Remove(xOpen);
}

Compilation message

Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:12:10: warning: unused variable 'need' [-Wunused-variable]
   12 |     char need = 'X';
      |          ^~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 496 KB Output is correct
2 Correct 2 ms 492 KB Output is correct
3 Correct 1 ms 484 KB Output is correct
4 Correct 2 ms 484 KB Output is correct
5 Correct 2 ms 484 KB Output is correct
6 Correct 2 ms 484 KB Output is correct
7 Correct 1 ms 484 KB Output is correct
8 Correct 0 ms 484 KB Output is correct
9 Correct 2 ms 496 KB Output is correct
10 Correct 2 ms 484 KB Output is correct
11 Correct 1 ms 484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 101 ms 9472 KB Partially correct
2 Partially correct 105 ms 9564 KB Partially correct
3 Partially correct 84 ms 9492 KB Partially correct
4 Partially correct 86 ms 9532 KB Partially correct
5 Partially correct 83 ms 9496 KB Partially correct
6 Partially correct 85 ms 9524 KB Partially correct
7 Partially correct 94 ms 9600 KB Partially correct
8 Partially correct 83 ms 9720 KB Partially correct
9 Partially correct 92 ms 9500 KB Partially correct
10 Partially correct 91 ms 9564 KB Partially correct
11 Partially correct 84 ms 9496 KB Partially correct
12 Partially correct 91 ms 9488 KB Partially correct
13 Partially correct 96 ms 9348 KB Partially correct
14 Partially correct 100 ms 9648 KB Partially correct
15 Partially correct 105 ms 9504 KB Partially correct
16 Partially correct 113 ms 9572 KB Partially correct
17 Partially correct 94 ms 9364 KB Partially correct
18 Partially correct 95 ms 9372 KB Partially correct
19 Partially correct 100 ms 9728 KB Partially correct
20 Partially correct 99 ms 9484 KB Partially correct
21 Partially correct 86 ms 9528 KB Partially correct
22 Partially correct 96 ms 9364 KB Partially correct
23 Partially correct 89 ms 9612 KB Partially correct
24 Partially correct 102 ms 9440 KB Partially correct
25 Partially correct 94 ms 9400 KB Partially correct
26 Partially correct 107 ms 9468 KB Partially correct
27 Partially correct 97 ms 9312 KB Partially correct
28 Partially correct 97 ms 9516 KB Partially correct
29 Partially correct 111 ms 9404 KB Partially correct
30 Partially correct 98 ms 9400 KB Partially correct
31 Partially correct 98 ms 9456 KB Partially correct
32 Partially correct 100 ms 9492 KB Partially correct
33 Partially correct 91 ms 9440 KB Partially correct