Submission #798386

# Submission time Handle Problem Language Result Execution time Memory
798386 2023-07-30T16:32:18 Z fatemetmhr Ancient Machine (JOI21_ancient_machine) C++17
30 / 100
77 ms 9820 KB
#include "Anna.h"

#include <bits/stdc++.h>

//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")

using namespace std;

typedef long long ll;

#define pb       push_back
#define mp       make_pair
#define all(x)   x.begin(), x.end()
#define fi       first
#define se       second

void Anna(int n, std::vector<char> s) {
    for(int i = 0; i < n; i++){
        if(s[i] == 'X'){
            Send(0);
            Send(0);
        }
        if(s[i] == 'Y'){
            Send(1);
            Send(0);
        }
        if(s[i] == 'Z'){
            Send(1);
            Send(1);
        }

    }
}
//  ~ Be Name Khoda ~  //

#include "Bruno.h"
#include <bits/stdc++.h>

//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")

using namespace std;

typedef long long ll;

#define pb       push_back
#define mp       make_pair
#define all(x)   x.begin(), x.end()
#define fi       first
#define se       second


void Bruno(int n, int l, std::vector<int> a){
    vector <int> av, have;
    for(int i = 0; i < n; i++){
        int cnt = a[2 * i] + a[2 * i + 1];
        have.pb(cnt);
        if(cnt == 0){
            if(av.size() && have[av.back()] == 0)
                Remove(i);
            else
                av.pb(i);
        }
        if(cnt == 1){
            if(av.empty() || have[av.back()] == 1)
                Remove(i);
            else
                av.pb(i);
        }
        if(cnt == 2){
            while(av.size() > 1){
                Remove(av.back());
                av.pop_back();
            }
            Remove(i);
        }
    }
    while(av.size()){
        Remove(av.back());
        av.pop_back();
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 516 KB Output is correct
2 Correct 1 ms 516 KB Output is correct
3 Correct 0 ms 508 KB Output is correct
4 Correct 0 ms 508 KB Output is correct
5 Correct 1 ms 508 KB Output is correct
6 Correct 2 ms 508 KB Output is correct
7 Correct 1 ms 508 KB Output is correct
8 Correct 0 ms 508 KB Output is correct
9 Correct 0 ms 508 KB Output is correct
10 Correct 0 ms 504 KB Output is correct
11 Correct 0 ms 516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 57 ms 9612 KB Partially correct
2 Partially correct 53 ms 9468 KB Partially correct
3 Partially correct 72 ms 9412 KB Partially correct
4 Partially correct 59 ms 9468 KB Partially correct
5 Partially correct 55 ms 9384 KB Partially correct
6 Partially correct 57 ms 9360 KB Partially correct
7 Partially correct 67 ms 9564 KB Partially correct
8 Partially correct 53 ms 9376 KB Partially correct
9 Partially correct 54 ms 9404 KB Partially correct
10 Partially correct 57 ms 9432 KB Partially correct
11 Partially correct 67 ms 9388 KB Partially correct
12 Partially correct 65 ms 9508 KB Partially correct
13 Partially correct 69 ms 9820 KB Partially correct
14 Partially correct 59 ms 9404 KB Partially correct
15 Partially correct 58 ms 9500 KB Partially correct
16 Partially correct 67 ms 9524 KB Partially correct
17 Partially correct 58 ms 9416 KB Partially correct
18 Partially correct 58 ms 9536 KB Partially correct
19 Partially correct 56 ms 9452 KB Partially correct
20 Partially correct 61 ms 9424 KB Partially correct
21 Partially correct 68 ms 9492 KB Partially correct
22 Partially correct 59 ms 9408 KB Partially correct
23 Partially correct 52 ms 9420 KB Partially correct
24 Partially correct 56 ms 9460 KB Partially correct
25 Partially correct 69 ms 9368 KB Partially correct
26 Partially correct 77 ms 9372 KB Partially correct
27 Partially correct 60 ms 9396 KB Partially correct
28 Partially correct 59 ms 9416 KB Partially correct
29 Partially correct 58 ms 9464 KB Partially correct
30 Partially correct 75 ms 9488 KB Partially correct
31 Partially correct 62 ms 9388 KB Partially correct
32 Partially correct 54 ms 9408 KB Partially correct
33 Partially correct 57 ms 9484 KB Partially correct