답안 #470680

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
470680 2021-09-05T02:42:59 Z jjang36524 Broken Device (JOI17_broken_device) C++14
0 / 100
41 ms 2628 KB
#include "Annalib.h"
#include "Brunolib.h"
int arr[200];
void Anna( int N, long long X, int K, int P[] )
{
	int i;
	for (i = 0; i < N; i++)
	{
		arr[i] = 0;
	}
	for (i = 0; i < K; i++)
	{
		arr[P[i]] = 1;
	}
	for(i = 0; i < N;)
	{
		int c = 0;
		int j;
		for (j = 0; j < 3; j++)
		{
			if (arr[i + j])
			{
				c += 1 << j;
			}
		}
		if (c == 0)
		{
			if (X % 4 == 0)
			{
				Set(i, 1);
				Set(i + 1, 0);
				Set(i + 2, 0);
			}
			else if (X % 4 == 1)
			{
				Set(i, 1);
				Set(i + 1, 0);
				Set(i + 2, 1);
			}
			else if (X % 4 == 2)
			{
				Set(i, 1);
				Set(i + 1, 1);
				Set(i + 2, 1);
			}
			else if (X % 4 == 3)
			{
				Set(i, 0);
				Set(i + 1, 1);
				Set(i + 2, 1);
			}
			X /= 4;
		}
		else if (c == 1)
		{
			if (X % 2)
			{
				Set(i, 0);
				Set(i + 1, 0);
				Set(i + 2, 1);
			}
			else
			{
				Set(i, 0);
				Set(i + 1, 1);
				Set(i + 2, 0);
			}
			X /= 2;
		}
		else if (c == 2)
		{
			if (X % 2)
			{
				Set(i, 0);
				Set(i + 1, 0);
				Set(i + 2, 1);
				X /= 2;
			}
			else
			{
				if (X % 4)
				{
					Set(i, 1);
					Set(i + 1, 0);
					Set(i + 2, 1);
				}
				else
				{
					Set(i, 1);
					Set(i + 1, 0);
					Set(i + 2, 0);
				}
				X /= 4;
			}
		}
		else if (c == 4)
		{
			if (X % 2)
			{
				Set(i, 1);
				Set(i + 1, 1);
				Set(i + 2, 0);
				
			}
			else
			{

				Set(i, 0);
				Set(i + 1, 1);
				Set(i + 2, 0);
			}
			X /= 2;
		}
		else
		{
			Set(i, 0);
			Set(i + 1, 0);
			Set(i + 2, 0);
		}
		i += 3;
	}
}
#include "Annalib.h"
#include "Brunolib.h"
long long Bruno(int N, int A[])
{
	long long ans = 0;
	int i;
	int t = 0;
	for (i = 0; i < N;i+=3)
	{
		if (t > 60)
			break;
		int x = 0;
		int j;
		for (j = 0; j < 3; j++)
		{
			if (A[i + j])
			{
				x += (1 << j);
			}
		}
		if (x == 1)
		{
			t += 2;
		}
		else if (x == 2)
		{
			t++;
		}
		else if (x == 3)
		{
			ans += 1LL << t;
			t++;
		}
		else if (x == 4)
		{
			ans += 1LL << t;
			t++;
		}
		else if (x == 5)
		{
			ans += 1LL << t;
			t += 2;
		}
		else if (x == 6)
		{
			ans += 3LL << t;
			t += 2;
		}
		else if (x == 7)
		{
			ans += 2LL << t;
			t += 2;
		}
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 40 ms 2580 KB Output isn't correct - L* = 0
2 Partially correct 38 ms 2472 KB Output isn't correct - L* = 0
3 Partially correct 38 ms 2500 KB Output isn't correct - L* = 0
4 Partially correct 38 ms 2444 KB Output isn't correct - L* = 0
5 Partially correct 41 ms 2412 KB Output isn't correct - L* = 0
6 Partially correct 38 ms 2520 KB Output isn't correct - L* = 0
7 Partially correct 37 ms 2572 KB Output isn't correct - L* = 0
8 Partially correct 37 ms 2444 KB Output isn't correct - L* = 0
9 Partially correct 38 ms 2504 KB Output isn't correct - L* = 0
10 Partially correct 38 ms 2512 KB Output isn't correct - L* = 0
11 Partially correct 38 ms 2460 KB Output isn't correct - L* = 0
12 Partially correct 38 ms 2496 KB Output isn't correct - L* = 0
13 Partially correct 37 ms 2472 KB Output isn't correct - L* = 0
14 Partially correct 38 ms 2488 KB Output isn't correct - L* = 0
15 Partially correct 38 ms 2476 KB Output isn't correct - L* = 0
16 Partially correct 37 ms 2584 KB Output isn't correct - L* = 0
17 Partially correct 37 ms 2496 KB Output isn't correct - L* = 0
18 Partially correct 38 ms 2504 KB Output isn't correct - L* = 0
19 Partially correct 37 ms 2524 KB Output isn't correct - L* = 0
20 Partially correct 37 ms 2516 KB Output isn't correct - L* = 0
21 Partially correct 37 ms 2536 KB Output isn't correct - L* = 0
22 Partially correct 40 ms 2496 KB Output isn't correct - L* = 0
23 Partially correct 38 ms 2436 KB Output isn't correct - L* = 0
24 Partially correct 39 ms 2528 KB Output isn't correct - L* = 0
25 Partially correct 37 ms 2468 KB Output isn't correct - L* = 0
26 Partially correct 37 ms 2556 KB Output isn't correct - L* = 0
27 Partially correct 37 ms 2452 KB Output isn't correct - L* = 0
28 Partially correct 38 ms 2448 KB Output isn't correct - L* = 0
29 Partially correct 37 ms 2436 KB Output isn't correct - L* = 0
30 Partially correct 40 ms 2628 KB Output isn't correct - L* = 0
31 Partially correct 36 ms 2432 KB Output isn't correct - L* = 0
32 Partially correct 37 ms 2452 KB Output isn't correct - L* = 0
33 Partially correct 36 ms 2452 KB Output isn't correct - L* = 0
34 Partially correct 37 ms 2540 KB Output isn't correct - L* = 0
35 Partially correct 37 ms 2476 KB Output isn't correct - L* = 0
36 Partially correct 37 ms 2412 KB Output isn't correct - L* = 0
37 Partially correct 39 ms 2488 KB Output isn't correct - L* = 0
38 Partially correct 37 ms 2528 KB Output isn't correct - L* = 0
39 Partially correct 38 ms 2528 KB Output isn't correct - L* = 0
40 Partially correct 39 ms 2444 KB Output isn't correct - L* = 0