# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
398194 | 4fecta | Ancient Machine (JOI21_ancient_machine) | C++17 | 79 ms | 8720 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<int, int>
#define f first
#define s second
#define boost() cin.tie(0), cin.sync_with_stdio(0)
void Anna(int N, vector<char> S) {
int cx = 0, cy = 0, cz = 0;
for (char c : S) {
if (c == 'X') cx++;
if (c == 'Y') cy++;
if (c == 'Z') cz++;
}
if (cx > cy && cx > cz) {
Send(0); Send(0);
for (char c : S) {
if (c == 'X') Send(0);
else if (c == 'Y') Send(1), Send(0);
else Send(1), Send(1);
}
} else if (cy > cx && cy > cz) {
Send(0); Send(1);
for (char c : S) {
if (c == 'Y') Send(0);
else if (c == 'X') Send(1), Send(0);
else Send(1), Send(1);
}
} else {
Send(1); Send(1);
for (char c : S) {
if (c == 'Z') Send(0);
else if (c == 'X') Send(1), Send(0);
else Send(1), Send(1);
}
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<int, int>
#define f first
#define s second
#define boost() cin.tie(0), cin.sync_with_stdio(0)
const int MN = 200005;
int n;
char a[MN];
void Bruno(int N, int L, vector<int> A) {
n = N;
int mode = A[0] + A[1];
int id = 2;
if (mode == 0) {
for (int i = 0; i < N; i++) {
if (!A[id++]) a[i] = 'X';
else if (!A[id++]) a[i] = 'Y';
else a[i] = 'Z';
}
} else if (mode == 1) {
for (int i = 0; i < N; i++) {
if (!A[id++]) a[i] = 'Y';
else if (!A[id++]) a[i] = 'X';
else a[i] = 'Z';
}
} else {
for (int i = 0; i < N; i++) {
if (!A[id++]) a[i] = 'Z';
else if (!A[id++]) a[i] = 'X';
else a[i] = 'Y';
}
}
stack<pii> s; //type, index
for (int i = 0; i < n; i++) {
if (a[i] == 'X') s.push({0, i});
else if (a[i] == 'Y') {
while (s.size() && s.top().f) Remove(s.top().s), s.pop();
if (s.empty()) Remove(i);
else s.push({1, i});
} else {
while (s.size() && s.top().f != 1) Remove(s.top().s), s.pop();
if (s.size()) Remove(s.top().s), s.pop(), Remove(s.top().s), s.pop();
Remove(i);
}
}
while (s.size()) Remove(s.top().s), s.pop();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |