답안 #945946

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
945946 2024-03-14T08:59:04 Z beepbeepsheep Ancient Machine (JOI21_ancient_machine) C++17
30 / 100
74 ms 10632 KB
#include "Anna.h"
#include <vector>

void Anna(int N, std::vector<char> S) {
    for (auto u:S){
        if (u=='X') Send(0),Send(0);
        if (u=='Y') Send(0),Send(1);
        if (u=='Z') Send(1),Send(0);
    }
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void Bruno(int N, int L, std::vector<int> A) {
    vector<char> v;
    for (int i=0;i<2*N;i+=2){
        ll res=A[i]*2+A[i+1];
        if (res==0) v.emplace_back('X');
        if (res==1) v.emplace_back('Y');
        if (res==2) v.emplace_back('Z');
    }
    stack<pair<ll,char>> s;
    ll cnty=0;
    vector<ll> out;
    for (int i=0;i<N;i++){
        if (v[i]=='X') s.emplace(i,'X');
        if (v[i]=='Y'){
            if (s.size() && s.top().second=='X')
                s.emplace(i,'Y'),cnty++;
            else out.emplace_back(i);
        }
        if (v[i]=='Z'){
            char c; ll idx;
            while (cnty){
                while (s.top().second!='Y'){
                    tie(idx,c)=s.top();
                    out.emplace_back(idx);
                    s.pop();
                }
                ll xidx,yidx;
                yidx=s.top().first;
                s.pop();
                out.emplace_back(yidx);
                cnty--;
                if (cnty>0){
                    xidx=s.top().first;
                    s.pop();
                    out.emplace_back(xidx);
                }
            }
            out.emplace_back(i);
        }
    }
    while (s.size()){
        out.emplace_back(s.top().first);
        s.pop();
    }
    for (auto u:out) Remove(u);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 780 KB Output is correct
2 Correct 0 ms 792 KB Output is correct
3 Correct 0 ms 780 KB Output is correct
4 Correct 0 ms 792 KB Output is correct
5 Correct 0 ms 780 KB Output is correct
6 Correct 0 ms 788 KB Output is correct
7 Correct 0 ms 788 KB Output is correct
8 Correct 0 ms 792 KB Output is correct
9 Correct 1 ms 780 KB Output is correct
10 Correct 0 ms 776 KB Output is correct
11 Correct 0 ms 792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 67 ms 10032 KB Partially correct
2 Partially correct 65 ms 10052 KB Partially correct
3 Partially correct 55 ms 10632 KB Partially correct
4 Partially correct 55 ms 10588 KB Partially correct
5 Partially correct 67 ms 10608 KB Partially correct
6 Partially correct 67 ms 10620 KB Partially correct
7 Partially correct 55 ms 10400 KB Partially correct
8 Partially correct 62 ms 10556 KB Partially correct
9 Partially correct 56 ms 10488 KB Partially correct
10 Partially correct 56 ms 10512 KB Partially correct
11 Partially correct 63 ms 10424 KB Partially correct
12 Partially correct 57 ms 10616 KB Partially correct
13 Partially correct 57 ms 10268 KB Partially correct
14 Partially correct 65 ms 10476 KB Partially correct
15 Partially correct 57 ms 10360 KB Partially correct
16 Partially correct 56 ms 10576 KB Partially correct
17 Partially correct 57 ms 10368 KB Partially correct
18 Partially correct 64 ms 10568 KB Partially correct
19 Partially correct 72 ms 10340 KB Partially correct
20 Partially correct 64 ms 10344 KB Partially correct
21 Partially correct 53 ms 10572 KB Partially correct
22 Partially correct 65 ms 10336 KB Partially correct
23 Partially correct 54 ms 10616 KB Partially correct
24 Partially correct 74 ms 10508 KB Partially correct
25 Partially correct 58 ms 10484 KB Partially correct
26 Partially correct 58 ms 10364 KB Partially correct
27 Partially correct 59 ms 10480 KB Partially correct
28 Partially correct 69 ms 10476 KB Partially correct
29 Partially correct 58 ms 10592 KB Partially correct
30 Partially correct 58 ms 10572 KB Partially correct
31 Partially correct 58 ms 10460 KB Partially correct
32 Partially correct 55 ms 10544 KB Partially correct
33 Partially correct 56 ms 10432 KB Partially correct