Submission #1151168

#TimeUsernameProblemLanguageResultExecution timeMemory
1151168minh30082008Ancient Machine (JOI21_ancient_machine)C++20
0 / 100
23 ms6080 KiB
#include "Anna.h"
#include <vector>

#include<bits/stdc++.h>
#define INF 1e18
#define fi first
#define se second
#define FOR(i, k, n) for(ll i = k; i <= n; i++)
#define FOR1(i, k, n) for(ll i = k; i >= n; i--)
#define pb push_back
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define ll long long
#define vll vector<ll>
#define pll pair<ll, ll>
#define re return 0
#define mii map<int, int>
#define input "chinaflu.inp"
#define output "chinaflu.out"
#define rf 	freopen(input, "r", stdin); freopen(output, "w", stdout)
using namespace std;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 9;
const int base = 998244353;
void add(int &a, int b) 
{
	a += b; 
	if(a >= mod) a -= mod; 
	if(a < 0) a += mod; 
}
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r)
{
	return uniform_int_distribution<int>(l, r) (rd);
}

void Anna(int n, vector<char> S) {
	int vt = -1;
	FOR(i, 0, n - 1)
		if(S[i] == 'X')
		{
			vt = i;
			break;
		}
	if(vt == 0)
	{
		Send(0);
		return;
	}
	FOR(i, 0, vt - 1)
	{
		Send(0);
	}
	Send(1);
	FOR(i, vt + 1, n - 1)
	{
		if(S[i] != 'Z')
			Send(0);
		else
			Send(1);
	}
	return;
}
#include "Bruno.h"
#include <vector>

#include<bits/stdc++.h>
#define INF 1e18
#define fi first
#define se second
#define FOR(i, k, n) for(ll i = k; i <= n; i++)
#define FOR1(i, k, n) for(ll i = k; i >= n; i--)
#define pb push_back
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define ll long long
#define vll vector<ll>
#define pll pair<ll, ll>
#define re return 0
#define mii map<int, int>
#define input "chinaflu.inp"
#define output "chinaflu.out"
#define rf 	freopen(input, "r", stdin); freopen(output, "w", stdout)
using namespace std;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 9;
const int base = 998244353;
void add(int &a, int b) 
{
	a += b; 
	if(a >= mod) a -= mod; 
	if(a < 0) a += mod; 
}
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r)
{
	return uniform_int_distribution<int>(l, r) (rd);
}
bool vis[maxn];
void Bruno(int n, int L, std::vector<int> A)
{
	int vt = -1;
	FOR(i, 0, n - 1)
		if(A[i])
		{
			vt = i;
			break;
		}
	if(vt == -1)
	{
		FOR(i, 0, n - 1)
			Remove(i);
		return;
	}
	int t = vt;
	vis[vt] = 1;
	FOR(i, 0, vt - 1)
	{
		Remove(i);
	}
	FOR(i, vt + 1, n - 1)
	{
		if(A[i])
		{
			int id = i - 1;
			while(!vis[id])
			{
				Remove(id);
				vis[id] = 1;
				id--;
			}
			Remove(i);
			vis[i] = 1;
			t = i;
		}
	}
	FOR(i, t + 1, n - 1)
		Remove(i);
	Remove(vt);
	return;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...