Submission #1032096

#TimeUsernameProblemLanguageResultExecution timeMemory
1032096Rafi22Ancient Machine (JOI21_ancient_machine)C++17
70 / 100
45 ms8804 KiB
#include "Anna.h"
#include <bits/stdc++.h>

using namespace std;

#ifdef DEBUG
auto&operator<<(auto&o,pair<auto,auto>p){return o<<"("<<p.first<<", "<<p.second<<")";}
auto operator<<(auto&o,auto x)->decltype(x.end(),o){o<<"{";int i=0;for(auto e:x)o<<","+!i++<<e;return o<<"}";}
#define debug(X...)cerr<<"["#X"]: ",[](auto...$){((cerr<<$<<"; "),...)<<endl;}(X)
#else
#define debug(...){}
#endif

#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define FOR(i,l,r) for(int i=(l);i<=(r);i++)
#define ROF(i,r,l) for(int i=(r);i>=(l);i--)

namespace {


}

void Anna(int n,vector<char>S)
{
	int xd=n;
	FOR(i,0,n-1)
	{
		if(S[i]=='X')
		{
			xd=i;
			break;
		}
	}
	vector<int>a(n-1,0);
	if(xd<n-1)
	{
		a[xd]=1;
		FOR(i,xd+1,n-2) if(S[i]=='Z'&&(i==n-1||S[i+1]!='Z')) a[i]=1;
	}
	FOR(i,0,n-2) Send(a[i]);
}
#include "Bruno.h"
#include <bits/stdc++.h>

using namespace std;

#ifdef DEBUG
auto&operator<<(auto&o,pair<auto,auto>p){return o<<"("<<p.first<<", "<<p.second<<")";}
auto operator<<(auto&o,auto x)->decltype(x.end(),o){o<<"{";int i=0;for(auto e:x)o<<","+!i++<<e;return o<<"}";}
#define debug(X...)cerr<<"["#X"]: ",[](auto...$){((cerr<<$<<"; "),...)<<endl;}(X)
#else
#define debug(...){}
#endif

#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define FOR(i,l,r) for(int i=(l);i<=(r);i++)
#define ROF(i,r,l) for(int i=(r);i>=(l);i--)

namespace {

}

void Bruno(int n,int l,vector<int>A)
{
	A.pb(1);
	int last=-1,k=-1;
	bool xd=0;
	FOR(i,0,n-1)
	{
		if(A[i])
		{
			if(!xd)
			{
				k=i;
				last=i;
				xd=1;
			}
			else
			{
				ROF(j,i-1,last+1) Remove(j);
				Remove(i);
				last=i;
			}
		}
	}
	FOR(i,0,k) Remove(i);
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...