Submission #504052

# Submission time Handle Problem Language Result Execution time Memory
504052 2022-01-09T15:15:11 Z ld_minh4354 Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
559 ms 9424 KB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;

void Anna(int N, std::vector<char> S) {
 	for (int i=0;i<N;i++)
 	if (S[i]=='X') Send(0),Send(0);
 	else if (S[i]=='Y') Send(0),Send(1);
 	else Send(1),Send(0);
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;


void Bruno(int N, int L,std::vector<int> A) {
  string s;
  int p=-1;
  bool ok;
  for (int i=0;i<L/2;i++)
  {
  	if (A[2*i]==0 and A[2*i+1]==0) s=s+"X";
  	else if (A[2*i]==0 and A[2*i+1]==1) s=s+"Y";
  	else s=s+"Z";
  }
  
  for (int i=0;i<N;i++) if (s[i]!='X') s[i]='A',Remove(i);else
  {
  	p=i;break;
  }
	
  if (p>=0)
  do
  { 
  	ok=0;
	for (int i=p;i<N;i++)
	if (s[i]=='Z')
  	{
  		ok=1;
  		for (int j=i-1;j>p;j--) if (s[j]!='A') s[j]='A',Remove(j);else break;
  		s[i]='A';Remove(i);
  		p=i+1;
  	}
  }
  while (ok);
  
  for (int i=0;i<N;i++) if (s[i]!='A') Remove(i);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 492 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 559 ms 9424 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -