Submission #798482

# Submission time Handle Problem Language Result Execution time Memory
798482 2023-07-30T18:24:28 Z fatemetmhr Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
40 ms 8184 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) {
    vector <int> av, have;
    bool found = false;
    int done = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'X'){
            done++;
            av.pb(i);
            Send(found);
            found = true;
        }
        if(s[i] == 'Y'){
            av.pb(i);
            Send(1);
        }
        if(s[i] == 'Z'){
            while(done >= 1){
                if(s[av.back()] == 'X')
                    done--;
                if(done == 0){
                    done++;
                    break;
                }
                av.pop_back();
            }
            Send(0);
        }
    }
}
//  ~ 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;
    int found = -1;
    for(int i = 0; i < n; i++){
        if(a[i])
            av.pb(i);
        else if(found == -1){
            found = i;
            av.pb(i);
        }
        else{
            while(av.size() && av.back() != found){
                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 504 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Incorrect 1 ms 512 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 39 ms 7744 KB Partially correct
2 Incorrect 40 ms 8184 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -