답안 #1001126

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1001126 2024-06-18T15:15:31 Z Tob Broken Device (JOI17_broken_device) C++14
100 / 100
27 ms 2916 KB
#include <bits/stdc++.h>
#include "Annalib.h"

#define F first
#define S second
#define all(x) x.begin(), x.end()
#define pb push_back
#define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;

typedef long long ll;
typedef pair <ll, ll> pii;

void Anna(int n, ll x, int k, int p[]) {
	int bio[150] = {0}, a[150] = {0};
	for (int i = 0; i < k; i++) bio[p[i]] = 1;
	for (ll i = 0, j = 0; i < n; i += 3) {
		int sum = bio[i]+bio[i+1]+bio[i+2];
		if (sum > 1) continue;
		int o = ((x >> j) & 1), o2 = ((x >> (j+1)) & 1);
		if (o) {
			if (sum == 0) a[i+1] = a[i+2] = 1, a[i] = o2, j += 2;
			else a[i] = bio[i+2], a[i+1] = bio[i+2], a[i+2] = bio[i+2]^1, j++;
		}
		else {
			if (bio[i+1] || sum == 0) a[i] = 1, a[i+2] = o2, j += 2;
			else a[i+1] = 1, j++;
		}
	}
	for (int i = 0; i < n; i++) Set(i, a[i]);
}
#include <bits/stdc++.h>
#include "Brunolib.h"

#define F first
#define S second
#define all(x) x.begin(), x.end()
#define pb push_back
#define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;

typedef long long ll;
typedef pair <ll, ll> pii;

int va[] = {0, 1, 0, 1, 0, 2, 1, 3};
int zn[] = {0, 1, 1, 2, 2, 2, 1, 2};

ll Bruno(int n, int a[]) {
	ll x = 0;
	for (int i = n-3; i >= 0; i -= 3) {
		int o = 4*a[i]+2*a[i+1]+a[i+2];
		if (o == 0) continue;
		if (zn[o] == 1) x = 2*x+va[o];
		else x = 4*x+va[o];
	}
	return x;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 2772 KB Output is correct - L* = 40
2 Correct 20 ms 2776 KB Output is correct - L* = 40
3 Correct 20 ms 2768 KB Output is correct - L* = 40
4 Correct 20 ms 2772 KB Output is correct - L* = 40
5 Correct 27 ms 2888 KB Output is correct - L* = 40
6 Correct 24 ms 2860 KB Output is correct - L* = 40
7 Correct 20 ms 2780 KB Output is correct - L* = 40
8 Correct 20 ms 2760 KB Output is correct - L* = 40
9 Correct 22 ms 2776 KB Output is correct - L* = 40
10 Correct 20 ms 2772 KB Output is correct - L* = 40
11 Correct 20 ms 2832 KB Output is correct - L* = 40
12 Correct 22 ms 2776 KB Output is correct - L* = 40
13 Correct 26 ms 2848 KB Output is correct - L* = 40
14 Correct 23 ms 2772 KB Output is correct - L* = 40
15 Correct 23 ms 2808 KB Output is correct - L* = 40
16 Correct 22 ms 2780 KB Output is correct - L* = 40
17 Correct 20 ms 2772 KB Output is correct - L* = 40
18 Correct 20 ms 2768 KB Output is correct - L* = 40
19 Correct 20 ms 2776 KB Output is correct - L* = 40
20 Correct 20 ms 2864 KB Output is correct - L* = 40
21 Correct 27 ms 2864 KB Output is correct - L* = 40
22 Correct 20 ms 2768 KB Output is correct - L* = 40
23 Correct 27 ms 2780 KB Output is correct - L* = 40
24 Correct 22 ms 2688 KB Output is correct - L* = 40
25 Correct 26 ms 2780 KB Output is correct - L* = 40
26 Correct 23 ms 2808 KB Output is correct - L* = 40
27 Correct 22 ms 2776 KB Output is correct - L* = 40
28 Correct 20 ms 2780 KB Output is correct - L* = 40
29 Correct 20 ms 2776 KB Output is correct - L* = 40
30 Correct 20 ms 2828 KB Output is correct - L* = 40
31 Correct 20 ms 2916 KB Output is correct - L* = 40
32 Correct 20 ms 2768 KB Output is correct - L* = 40
33 Correct 23 ms 2764 KB Output is correct - L* = 40
34 Correct 22 ms 2752 KB Output is correct - L* = 40
35 Correct 20 ms 2776 KB Output is correct - L* = 40
36 Correct 20 ms 2776 KB Output is correct - L* = 40
37 Correct 20 ms 2772 KB Output is correct - L* = 40
38 Correct 20 ms 2756 KB Output is correct - L* = 40
39 Correct 20 ms 2772 KB Output is correct - L* = 40
40 Correct 20 ms 2776 KB Output is correct - L* = 40