답안 #664249

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
664249 2022-11-27T06:52:17 Z blue Ancient Machine (JOI21_ancient_machine) C++17
69 / 100
74 ms 8728 KB
#include "Anna.h"
#include <bits/stdc++.h>

namespace
{
	using namespace std;
	using vi = vector<int>;
}

void Anna(int N, vector<char> S)
{
	// cerr << "hello\n";
	int fx = 0;
	int lz = N-1;

	while(fx < N && S[fx] != 'X')
		fx++;

	while(lz >= 0 && S[lz] != 'Z')
		lz--;

	if(fx == N || lz == -1)
	{
		// cerr << "hello2\n";
		return;
	}

	vi tosend(N+1, 0);

	tosend[fx] = 1;
	tosend[lz+1] = 1;

	for(int i = fx+2; i <= lz-1; i++)
	{
		if(S[i-1] == 'Z' && S[i] == 'Y')
			tosend[i] = 1;
	}

	// for(int i = 0; i <= N; i++)
	// 	cerr << tosend[i];
	// cerr << '\n';

	for(int f : tosend)
		Send(f);
}
#include "Bruno.h"
#include <bits/stdc++.h>

namespace
{
	using namespace std;

	using vi = vector<int>;
	using pii = pair<int, int>;
	using vpii = vector<pii>;
}

void Bruno(int N, int L, vi A)
{
	if(A.empty())
	{
		for(int i = 0; i < N; i++)
			Remove(i);

		return;
	}

	int lz = N;
	while(A[lz] != 1)
		lz--;
	lz--;

	int fx = 0;
	while(A[fx] != 1)
		fx++;

	// cerr << fx << ' ' << lz << '\n';

	for(int i = 0; i < fx; i++)
		Remove(i);
	for(int i = lz+1; i < N; i++)
		Remove(i);

	vi st;

	for(int i = fx+1; i <= lz; i++)
	{
		if(i < lz && A[i+1] == 0)
		{
			// cerr << "add " << i << " to stack\n";
			st.push_back(i);
		}
		else
		{
			while(!st.empty())
			{
				Remove(st.back());
				// cerr << "pop " << st.back() << '\n';
				st.pop_back();
			}
			Remove(i);
			// cerr << "remove Z : " << i << '\n';
		}
	}

	Remove(fx);
	// cerr << "final remove " << fx << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 512 KB Output is correct
2 Correct 0 ms 516 KB Output is correct
3 Correct 0 ms 616 KB Output is correct
4 Correct 0 ms 512 KB Output is correct
5 Correct 0 ms 512 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 0 ms 640 KB Output is correct
8 Correct 1 ms 516 KB Output is correct
9 Correct 0 ms 516 KB Output is correct
10 Correct 0 ms 520 KB Output is correct
11 Correct 0 ms 520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 49 ms 8424 KB Partially correct
2 Partially correct 60 ms 8440 KB Partially correct
3 Partially correct 48 ms 8464 KB Partially correct
4 Partially correct 49 ms 8396 KB Partially correct
5 Partially correct 49 ms 8456 KB Partially correct
6 Partially correct 49 ms 8480 KB Partially correct
7 Partially correct 49 ms 8504 KB Partially correct
8 Partially correct 52 ms 8484 KB Partially correct
9 Partially correct 52 ms 8472 KB Partially correct
10 Partially correct 52 ms 8480 KB Partially correct
11 Partially correct 51 ms 8520 KB Partially correct
12 Partially correct 49 ms 8468 KB Partially correct
13 Partially correct 56 ms 8492 KB Partially correct
14 Partially correct 74 ms 8392 KB Partially correct
15 Partially correct 56 ms 8728 KB Partially correct
16 Partially correct 57 ms 8452 KB Partially correct
17 Correct 45 ms 6748 KB Output is correct
18 Correct 43 ms 6720 KB Output is correct
19 Correct 45 ms 6656 KB Output is correct
20 Partially correct 51 ms 8364 KB Partially correct
21 Partially correct 54 ms 8472 KB Partially correct
22 Partially correct 55 ms 8588 KB Partially correct
23 Partially correct 62 ms 8352 KB Partially correct
24 Partially correct 56 ms 8340 KB Partially correct
25 Correct 44 ms 6780 KB Output is correct
26 Correct 43 ms 6796 KB Output is correct
27 Partially correct 59 ms 8616 KB Partially correct
28 Correct 48 ms 6720 KB Output is correct
29 Correct 44 ms 6756 KB Output is correct
30 Correct 43 ms 6756 KB Output is correct
31 Correct 45 ms 6772 KB Output is correct
32 Partially correct 51 ms 8384 KB Partially correct
33 Partially correct 60 ms 8436 KB Partially correct