Submission #504058

# Submission time Handle Problem Language Result Execution time Memory
504058 2022-01-09T15:29:47 Z ld_minh4354 Ancient Machine (JOI21_ancient_machine) C++17
30 / 100
663 ms 10328 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);
  	}
  }
  while (ok);
  
  for (int i=0;i<N;i++) if (s[i]!='A') Remove(i);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 488 KB Output is correct
2 Correct 0 ms 580 KB Output is correct
3 Correct 0 ms 500 KB Output is correct
4 Correct 0 ms 496 KB Output is correct
5 Correct 1 ms 496 KB Output is correct
6 Correct 0 ms 496 KB Output is correct
7 Correct 1 ms 496 KB Output is correct
8 Correct 0 ms 420 KB Output is correct
9 Correct 0 ms 488 KB Output is correct
10 Correct 1 ms 496 KB Output is correct
11 Correct 1 ms 496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 548 ms 9308 KB Partially correct
2 Partially correct 545 ms 9620 KB Partially correct
3 Partially correct 610 ms 9636 KB Partially correct
4 Partially correct 549 ms 9704 KB Partially correct
5 Partially correct 539 ms 9664 KB Partially correct
6 Partially correct 579 ms 9720 KB Partially correct
7 Partially correct 548 ms 10128 KB Partially correct
8 Partially correct 569 ms 9704 KB Partially correct
9 Partially correct 566 ms 9748 KB Partially correct
10 Partially correct 591 ms 9868 KB Partially correct
11 Partially correct 536 ms 9780 KB Partially correct
12 Partially correct 551 ms 9572 KB Partially correct
13 Partially correct 577 ms 9628 KB Partially correct
14 Partially correct 663 ms 9976 KB Partially correct
15 Partially correct 623 ms 9636 KB Partially correct
16 Partially correct 623 ms 9612 KB Partially correct
17 Partially correct 585 ms 9732 KB Partially correct
18 Partially correct 658 ms 9768 KB Partially correct
19 Partially correct 570 ms 9588 KB Partially correct
20 Partially correct 552 ms 9744 KB Partially correct
21 Partially correct 571 ms 10328 KB Partially correct
22 Partially correct 566 ms 9804 KB Partially correct
23 Partially correct 558 ms 9596 KB Partially correct
24 Partially correct 580 ms 10280 KB Partially correct
25 Partially correct 622 ms 9872 KB Partially correct
26 Partially correct 552 ms 9616 KB Partially correct
27 Partially correct 613 ms 9612 KB Partially correct
28 Partially correct 590 ms 9672 KB Partially correct
29 Partially correct 583 ms 9608 KB Partially correct
30 Partially correct 562 ms 9816 KB Partially correct
31 Partially correct 548 ms 9592 KB Partially correct
32 Partially correct 571 ms 9636 KB Partially correct
33 Partially correct 569 ms 9672 KB Partially correct