답안 #546358

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
546358 2022-04-07T11:04:43 Z flappybird Ancient Machine (JOI21_ancient_machine) C++17
98 / 100
68 ms 8616 KB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX 101010
#define B1 62
#define B2 44

namespace {
	vector<int> arr;
	vector<ll> fibo = { 2, 3 };
	vector<vector<int>> bukkit;
}

void Anna(int N, std::vector<char> S) {
	arr.resize(N);
	int i, c;
	c = 0;
	fibo.resize(B1);
	S.push_back(' ');
	for (i = 2; i < B1; i++) fibo[i] = fibo[i - 1] + fibo[i - 2];
	int start = N;
	for (i = 0; i < N; i++) {
		if (!c && S[i] == 'X') c = 1, start = i;
		else if (c && S[i] == 'Z' && S[i + 1] != 'Z') arr[i] = 1;
	}
	bukkit.push_back(vector<int>());
	for (i = 0; i < N; i++) {
		if (bukkit.back().size() == B1) bukkit.push_back(vector<int>());
		bukkit.back().push_back(arr[i]);
	}
	bukkit.back().resize(B1);
	int bs = bukkit.size();
	ll res = 0;
	for (i = 0; i < bs; i++) {
		int j;
		res = 0;
		for (j = 0; j < B1; j++) if (bukkit[i][j]) res += fibo[j];
		for (j = 0; j < B2; j++) {
			if (res & (1ll << (ll)j)) Send(1);
			else Send(0);
		}
	}
	for (i = 0; i < 17; i++) Send((bool)((1 << i) & start));
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

namespace {
	const int B1 = 62;
	const int B2 = 44;
	vector<ll> fibo = { 2, 3 };
}  // namespace

void Bruno(int N, int L, std::vector<int> A) {
	vector<int> sv;
	int i;
	for (i = 0; i < 17; i++) sv.push_back(A.back()), A.pop_back();
	reverse(sv.begin(), sv.end());
	int start = 0;
	for (i = 0; i < 17; i++) start += sv[i] * (1 << i);
	L = A.size();
	if (start == N) start = -1;
	int K = L / B2;
	fibo.resize(B1);
	for (i = 2; i < B1; i++) fibo[i] = fibo[i - 1] + fibo[i - 2];
	vector<int> arr;
	for (i = 0; i < K; i++) {
		ll res = 0;
		ll j;
		for (j = 0; j < B2; j++) res += (ll)A[(ll)i * (ll)B2 + j] << (ll)j;
		vector<int> v;
		for (j = B1 - 1; j >= 0; j--) {
			if (res >= fibo[j]) res -= fibo[j], v.push_back(1);
			else v.push_back(0);
		}
		reverse(v.begin(), v.end());
		for (auto x : v) arr.push_back(x);
	}
	arr.resize(N);
	vector<int> ones;
	if (start == -1) {
		for (i = 0; i < N; i++) Remove(i);
		return;
	}
	for (i = 0; i < N; i++) if (arr[i]) ones.push_back(i);
	if (ones.empty()) {
		for (i = 0; i < N; i++) Remove(i);
		return;
	}
	for (i = 0; i < start; i++) Remove(i);
	int pv = start;
	for (auto v : ones) {
		for (i = v - 1; i > pv; i--) Remove(i);
		Remove(v);
		pv = v;
	}
	Remove(start);
	for (i = pv + 1; i < N; i++) Remove(i);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 508 KB Output is correct
2 Correct 0 ms 516 KB Output is correct
3 Correct 0 ms 516 KB Output is correct
4 Correct 0 ms 508 KB Output is correct
5 Correct 1 ms 520 KB Output is correct
6 Correct 0 ms 516 KB Output is correct
7 Correct 1 ms 508 KB Output is correct
8 Correct 0 ms 520 KB Output is correct
9 Correct 0 ms 508 KB Output is correct
10 Correct 0 ms 504 KB Output is correct
11 Correct 0 ms 516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 53 ms 8568 KB Partially correct
2 Partially correct 49 ms 8484 KB Partially correct
3 Partially correct 55 ms 8480 KB Partially correct
4 Partially correct 56 ms 8436 KB Partially correct
5 Partially correct 52 ms 8532 KB Partially correct
6 Partially correct 53 ms 8500 KB Partially correct
7 Partially correct 56 ms 8420 KB Partially correct
8 Partially correct 67 ms 8492 KB Partially correct
9 Partially correct 52 ms 8504 KB Partially correct
10 Partially correct 48 ms 8488 KB Partially correct
11 Partially correct 54 ms 8600 KB Partially correct
12 Partially correct 61 ms 8488 KB Partially correct
13 Partially correct 67 ms 8556 KB Partially correct
14 Partially correct 56 ms 8616 KB Partially correct
15 Partially correct 55 ms 8544 KB Partially correct
16 Partially correct 68 ms 8456 KB Partially correct
17 Partially correct 62 ms 8416 KB Partially correct
18 Partially correct 55 ms 8376 KB Partially correct
19 Partially correct 55 ms 8280 KB Partially correct
20 Partially correct 48 ms 8548 KB Partially correct
21 Partially correct 56 ms 8444 KB Partially correct
22 Partially correct 57 ms 8352 KB Partially correct
23 Partially correct 49 ms 8592 KB Partially correct
24 Partially correct 49 ms 8588 KB Partially correct
25 Partially correct 54 ms 8508 KB Partially correct
26 Partially correct 61 ms 8424 KB Partially correct
27 Partially correct 55 ms 8360 KB Partially correct
28 Partially correct 54 ms 8404 KB Partially correct
29 Partially correct 55 ms 8480 KB Partially correct
30 Partially correct 55 ms 8344 KB Partially correct
31 Partially correct 61 ms 8480 KB Partially correct
32 Partially correct 55 ms 8524 KB Partially correct
33 Partially correct 49 ms 8576 KB Partially correct