Submission #798408

#TimeUsernameProblemLanguageResultExecution timeMemory
798408NothingXDAncient Machine (JOI21_ancient_machine)C++17
70 / 100
64 ms8360 KiB
/*
High hopes and noble endeavors...
Will shine with all the twinkling stars.
We hold you next to us...
The galaxy, so glorious.
We'll build with all of our dreams...
A new world that bravely gleams.
Char is fighting for our prayers!
Char is fighting for our prayers!
*/
#include "Anna.h"
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef complex<double> point;


namespace {

	void debug_out(){cerr << endl;}

	template<typename Head, typename... Tail>
		void debug_out(Head H, Tail... T){
			cerr << H << ' ';
			debug_out(T...);
		}

#define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define MP(x, y) make_pair(x, y)

	const int maxn = 1e5 + 10;
	int n;
	string s;
}

void Anna(int N, std::vector<char> S) {
	n = N;
	for (int i = 0; i < n; i++){
		s.push_back(S[i]);
	}
	vector<int> v;
	for (int i = 0; i < n; i++){
		if (v.empty() && s[i] == 'X'){
			Send(1);
			v.push_back(i);
		}
		else if (v.empty()){
			Send(0);
		}
		else{
			if (s[i] != 'Z'){
				v.push_back(i);
				Send(1);
			}
			else{
				while(v.size() > 1){
					v.pop_back();
				}
				Send(0);
			}
		}
	}
}
/*
High hopes and noble endeavors...
Will shine with all the twinkling stars.
We hold you next to us...
The galaxy, so glorious.
We'll build with all of our dreams...
A new world that bravely gleams.
Char is fighting for our prayers!
Char is fighting for our prayers!
*/

#include "Bruno.h"
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef complex<double> point;

namespace {

	void debug_out(){cerr << endl;}

	template<typename Head, typename... Tail>
		void debug_out(Head H, Tail... T){
			cerr << H << ' ';
			debug_out(T...);
		}

#define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define MP(x, y) make_pair(x, y)

	const int maxn = 1e5 + 10;
	int n;
	string s;
}

void Bruno(int N, int L, std::vector<int> A) {
	n = N;
	vector<int> v;
	for (int i = 0; i < n; i++){
		if (v.empty()){
			if (A[i] == 0){
				Remove(i);
			}
			else{
				v.push_back(i);
			}
		}
		else{
			if (A[i] == 1){
				v.push_back(i);
			}
			else{
				while(v.size() > 1){
					Remove(v.back());
					v.pop_back();
				}
				Remove(i);
			}
		}
	}
	while(!v.empty()){
		Remove(v.back());
		v.pop_back();
	}
}

Compilation message (stderr)

Anna.cpp:25:7: warning: 'void {anonymous}::debug_out()' defined but not used [-Wunused-function]
   25 |  void debug_out(){cerr << endl;}
      |       ^~~~~~~~~

Bruno.cpp:25:7: warning: 'void {anonymous}::debug_out()' defined but not used [-Wunused-function]
   25 |  void debug_out(){cerr << endl;}
      |       ^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...