Submission #518908

# Submission time Handle Problem Language Result Execution time Memory
518908 2022-01-25T06:03:13 Z Keshi Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
78 ms 9104 KB
#include "Anna.h"
#include <vector>


void Anna(int N, std::vector<char> S){
	std::vector<bool> vis(N, 0);
	for(int i = 0; i < N; i++){
		if(i > 0 && i + 1 < N && S[i - 1] == 'X' && S[i] == 'Y' && S[i + 1] == 'Z'){
			Send(1);
			vis[i] = 1;
		}
		else Send(0);
	}
	char x = 'X';
	for(int i = 0; i < N; i++){
		if(!vis[i] && S[i] == x){
			Send(1);
			if(x == 'X') x = 'Y';
			else if(x == 'Y') x = 'Z';
			else x = 'Y';
		}
		else Send(0);
	}
	return;
}
//In the name of God
#include <bits/stdc++.h>
using namespace std;
#include "Bruno.h"

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int maxn = 2e5 + 100;
const int mod = 1e9 + 7;
const int inf = 1e9;

#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io freopen("input.txt", "r+", stdin);freopen("output.txt", "w+", stdout);
#define pb push_back
#define Mp make_pair
#define F first
#define S second
#define Sz(x) ll((x).size())
#define all(x) (x).begin(), (x).end()

ll pw(ll a, ll b){
	ll c = 1;
	while(b){
		if(b & 1) c = c * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return c;
}

void Bruno(int N, int L, vector<int> A){
	assert(N * 2 == L);
	assert(L == Sz(A));
	for(int i = 0; i < N; i++){
		if(A[i]) Remove(i);
	}
	vector<int> vec;
	for(int i = 0; i < N; i++){
		if(A[N + i]) vec.pb(i);
		else if(!A[i]) Remove(i);
	}
	for(int i = 1; i < Sz(vec); i++){
		Remove(vec[i]);
	}
	Remove(vec[0]);
	return;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 488 KB Output is correct
2 Correct 0 ms 484 KB Output is correct
3 Correct 0 ms 492 KB Output is correct
4 Correct 0 ms 484 KB Output is correct
5 Incorrect 0 ms 492 KB Wrong Answer [6]
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 78 ms 9104 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -