Submission #1309011

#TimeUsernameProblemLanguageResultExecution timeMemory
1309011sweetwibu2k8Ancient Machine (JOI21_ancient_machine)C++20
0 / 100
323 ms327680 KiB
#include <bits/stdc++.h>
#include "Anna.h"
using namespace std;

#define endl "\n"
#define fi first
#define se second
#define pb push_back
#define p_q priority_queue
#define bit(n, i) (((n)>>(i))&1)
#define all(x) x.begin(), x.end()

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector <vector <int> > vvi;

const int M = 1e6 + 6;
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;

void maximize (int &a, int b) { if (a < b) a = b; }
void minimize (int &a, int b) { if (a > b) a = b; }
void add (int &a, int b) { a += b; if (a >= mod) a -= mod; }
void del (int &a, int b) { a -= b; if (a < 0) a += mod; }

// Anna

void Anna (int N, vector <char> S)
{
	bool flag = false;
	for (int i = 0; i < N; i ++)
	{
		if (!flag)
		{
			if (S[i] == 'X') Send (1), flag = true;
			else Send (0);
		}
		else if (S[i] == 'X' or S[i] == 'Y') Send (0);
		else Send (1);
	}
}

#include <bits/stdc++.h>
#include "Bruno.h"
using namespace std;

#define endl "\n"
#define fi first
#define se second
#define pb push_back
#define p_q priority_queue
#define bit(n, i) (((n)>>(i))&1)
#define all(x) x.begin(), x.end()

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector <vector <int> > vvi;

const int M = 1e6 + 6;
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;

void maximize (int &a, int b) { if (a < b) a = b; }
void minimize (int &a, int b) { if (a > b) a = b; }
void add (int &a, int b) { a += b; if (a >= mod) a -= mod; }
void del (int &a, int b) { a -= b; if (a < 0) a += mod; }


// Bruno

void Bruno (int N, int L, vector <int> A)
{
	vector <int> st;
	reverse (all (A));
	int cnt = 0;
	while (A.size() and A.back() == 0)
	{
		Remove (cnt);
		cnt ++;
		A.pop_back ();
	}
	
	int firstX = cnt ++; A.pop_back ();
	while (A.size())
	{
		if (A.back () == 1)
		{
			while (st.size())
			{
				Remove (st.back());
				st.pop_back ();
			}
			Remove (cnt);
		}
		else st.pb (cnt);
		cnt ++;
	}
	Remove (firstX);
	while (st.size())
	{
		Remove (st.back());
		st.pop_back ();
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...