# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1153741 | sunflower | Ancient Machine (JOI21_ancient_machine) | C++17 | 15 ms | 1468 KiB |
#ifndef SUN
#include "Anna.h"
#endif // SUN
#include <bits/stdc++.h>
using namespace std;
#define MASK(x) (1LL << (x))
#define BIT(x, i) (((x) >> (i)) & 1)
template <class X, class Y>
bool maximize(X &x, Y y) {
if (x < y) return x = y, true;
else return false;
}
void Anna(int n, std::vector <char> s) {
string str = "";
int firstX = -1;
for (int i = 0; i < (int) s.size(); ++i) {
if (s[i] == 'X') {
if (firstX == -1) {
firstX = i;
str += '1';
} else str += '0';
} else {
if (firstX == -1) str += '0';
else {
if (s[i] == 'Z' && (i == (int) s.size() - 1 || (i + 1 < (int) s.size() && s[i] != s[i + 1]))) str += '1';
else str += '0';
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |