제출 #664249

#제출 시각아이디문제언어결과실행 시간메모리
664249blueAncient Machine (JOI21_ancient_machine)C++17
69 / 100
74 ms8728 KiB
#include "Anna.h" #include <bits/stdc++.h> namespace { using namespace std; using vi = vector<int>; } void Anna(int N, vector<char> S) { // cerr << "hello\n"; int fx = 0; int lz = N-1; while(fx < N && S[fx] != 'X') fx++; while(lz >= 0 && S[lz] != 'Z') lz--; if(fx == N || lz == -1) { // cerr << "hello2\n"; return; } vi tosend(N+1, 0); tosend[fx] = 1; tosend[lz+1] = 1; for(int i = fx+2; i <= lz-1; i++) { if(S[i-1] == 'Z' && S[i] == 'Y') tosend[i] = 1; } // for(int i = 0; i <= N; i++) // cerr << tosend[i]; // cerr << '\n'; for(int f : tosend) Send(f); }
#include "Bruno.h" #include <bits/stdc++.h> namespace { using namespace std; using vi = vector<int>; using pii = pair<int, int>; using vpii = vector<pii>; } void Bruno(int N, int L, vi A) { if(A.empty()) { for(int i = 0; i < N; i++) Remove(i); return; } int lz = N; while(A[lz] != 1) lz--; lz--; int fx = 0; while(A[fx] != 1) fx++; // cerr << fx << ' ' << lz << '\n'; for(int i = 0; i < fx; i++) Remove(i); for(int i = lz+1; i < N; i++) Remove(i); vi st; for(int i = fx+1; i <= lz; i++) { if(i < lz && A[i+1] == 0) { // cerr << "add " << i << " to stack\n"; st.push_back(i); } else { while(!st.empty()) { Remove(st.back()); // cerr << "pop " << st.back() << '\n'; st.pop_back(); } Remove(i); // cerr << "remove Z : " << i << '\n'; } } Remove(fx); // cerr << "final remove " << fx << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...