제출 #1071151

#제출 시각아이디문제언어결과실행 시간메모리
1071151thinknoexitAncient Machine (JOI21_ancient_machine)C++17
0 / 100
39 ms8936 KiB
#include "Anna.h" #include<bits/stdc++.h> using namespace std; using ll = long long; namespace { int n; } void Anna(int N, vector<char> S) { n = N; for (int i = 0;i < n;i++) { int v = S[i] - 'X'; Send(!!(v & 1)); Send(!!(v & 2)); } }
#include "Bruno.h" #include<bits/stdc++.h> using namespace std; using ll = long long; namespace { int n; int a[100100]; } // namespace void Bruno(int N, int L, vector<int> A) { n = N; for (int i = 0;i < n;i++) { a[i] = A[2 * i] + 2 * A[2 * i + 1]; } stack<int> x, z; for (int i = n - 1;i >= 0;i--) if (a[i] == 2) z.push(i); for (int i = 0;i < n;i++) { while (!z.empty() && z.top() <= i) z.pop(); if (a[i] == 0) x.push(i); else if (a[i] == 1) { if (x.empty() || z.empty()) { Remove(i); continue; } int l = x.top(), r = z.top(); x.pop(), z.pop(); for (int j = i + 1;j < r;j++) Remove(j); Remove(i); Remove(l), Remove(r); i = r; } } while (!x.empty()) { Remove(x.top()); x.pop(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...