# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
709596 | yuuhi | Ancient Machine (JOI21_ancient_machine) | C++17 | 73 ms | 8340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include "Anna.h"
#define f first
#define s second
#define double long double
#define _size(x) ((int)((x).size()))
using namespace std ;
typedef pair< int , int > ii ;
void Anna (int n , vector< char > s) {
int flag = 0 ;
for (int i = 0 ; i < n ; ++ i) {
if (!flag && s[i] == 'X') {
flag = 1 ;
Send(1) ;
continue ;
}
if (!flag) {
Send(0) ;
continue ;
}
if (s[i] == 'Z') {
Send(1) ;
}
else {
Send(0) ;
}
}
}
#include<bits/stdc++.h>
#include "Bruno.h"
#define f first
#define s second
#define double long double
#define _size(x) ((int)((x).size()))
using namespace std ;
typedef pair< int , int > ii ;
void Bruno (int n , int L , vector< int > b) {
vector< int > erased(n) ;
auto Erase = [&](int x) {
if (erased[x]) return ;
erased[x] = 1 ;
Remove(x) ;
};
for (int i = 0 , last = -1 ; i < n ; ++ i) if (b[i]) {
if (last != -1) {
for (int j = i - 1 ; j >= last + 1 ; -- j) Erase(j) ;
Erase(i) ;
}
last = i ;
}
for (int i = 0 ; i < n ; ++ i) Erase(i) ;
}
/*
10
X Y Y X Z Y X Z Y Z
*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |