Submission #615476

# Submission time Handle Problem Language Result Execution time Memory
615476 2022-07-31T09:40:22 Z 장태환(#8493) Broken Device 2 (JOI22_device2) C++17
40 / 100
702 ms 29492 KB
#include "Anna.h"
#include <utility>
#include <vector>
using namespace std;
namespace {

int variable_example = 0;
long long dp[2010];
}

int Declare() {
  variable_example++;
  return 2000;
}

std::pair<std::vector<int>, std::vector<int> > Anna(long long A) 
{
std::vector<int> X;
std::vector<int> Y;
int i;
for (i = 1; i <= 2000; i++)
{
	int a = i / 3;
	int b = i / 3;
	long long c = i - a - b;
	dp[i] = (a + 1) * (b + 1) * (c + 1);
}
for (i = 1; i <= 2020; i++)
{
	if (A < dp[i])
	{
		int a = i / 3;
		int b = i / 3;
		int c = i - a - b;
		int j;
		for (j = 0; j < a; j++)
		{
			X.push_back(j<A%(a+1));
			Y.push_back(j>=(a- A % (a + 1)));
		}
		A /= a + 1;
		for (j = 0; j < b; j++)
		{
			X.push_back(j < A % (b + 1));
			Y.push_back(j >= (b - A % (b + 1)));
		}
		A /= b + 1;
		for (j = 0; j < c; j++)
		{
			X.push_back(j < A % (c + 1));
			Y.push_back(j >= (c - A % (c + 1)));
		}
		return{ X,Y };
	}
	else
	{
		A -= dp[i];
	}
}
}
#include "Bruno.h"
#include <utility>
#include <vector>

namespace {

int variable_example = 0;
long long dp[2010];
}

long long Bruno(std::vector<int> u) {
	int i;
	for (i = 1; i < u.size(); i++)
	{
		u[i] += u[i - 1];
	}
	for (i = 1; i <= 2000; i++)
	{
		int a = i / 3;
		int b = i / 3;
		long long c = i - a - b;
		dp[i] = (a + 1) * (b + 1) * (c + 1);
	}
	long long ans = 0;
	for (i = 1; i < u.size()/2; i++)
	{
		ans += dp[i];
	}
	int a = i / 3;
	int b = i / 3;
	int c = u.size() / 2 - a - b;
	int aa = a?u[a-1]:0;
	int cc = u.back() - (u.size() == c ? 0 : u[u.size() - 1 - c]);
	ans += aa;
	ans += cc*(a+1)*(b+1);
	ans += (u.back()/2 - aa - cc) * (a + 1);
	return ans;
}

Compilation message

Anna.cpp: In function 'std::pair<std::vector<int>, std::vector<int> > Anna(long long int)':
Anna.cpp:18:18: warning: control reaches end of non-void function [-Wreturn-type]
   18 | std::vector<int> X;
      |                  ^

Bruno.cpp: In function 'long long int Bruno(std::vector<int>)':
Bruno.cpp:13:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |  for (i = 1; i < u.size(); i++)
      |              ~~^~~~~~~~~~
Bruno.cpp:25:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |  for (i = 1; i < u.size()/2; i++)
      |              ~~^~~~~~~~~~~~
Bruno.cpp:33:32: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |  int cc = u.back() - (u.size() == c ? 0 : u[u.size() - 1 - c]);
      |                       ~~~~~~~~~^~~~
Bruno.cpp: At global scope:
Bruno.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    7 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 516 KB Output is correct
2 Correct 17 ms 792 KB Output is correct
3 Correct 19 ms 876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 516 KB Output is correct
2 Correct 17 ms 792 KB Output is correct
3 Correct 19 ms 876 KB Output is correct
4 Correct 55 ms 2428 KB Output is correct
5 Correct 56 ms 2420 KB Output is correct
6 Correct 55 ms 2536 KB Output is correct
7 Correct 59 ms 2504 KB Output is correct
8 Correct 69 ms 2676 KB Output is correct
9 Correct 76 ms 2792 KB Output is correct
10 Correct 63 ms 2756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 516 KB Output is correct
2 Correct 17 ms 792 KB Output is correct
3 Correct 19 ms 876 KB Output is correct
4 Correct 55 ms 2428 KB Output is correct
5 Correct 56 ms 2420 KB Output is correct
6 Correct 55 ms 2536 KB Output is correct
7 Correct 59 ms 2504 KB Output is correct
8 Correct 69 ms 2676 KB Output is correct
9 Correct 76 ms 2792 KB Output is correct
10 Correct 63 ms 2756 KB Output is correct
11 Correct 77 ms 3076 KB Output is correct
12 Correct 70 ms 2964 KB Output is correct
13 Correct 72 ms 2932 KB Output is correct
14 Correct 71 ms 2928 KB Output is correct
15 Correct 79 ms 2948 KB Output is correct
16 Correct 82 ms 3328 KB Output is correct
17 Correct 78 ms 3396 KB Output is correct
18 Correct 70 ms 2540 KB Output is correct
19 Correct 57 ms 2532 KB Output is correct
20 Correct 56 ms 2456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 516 KB Output is correct
2 Correct 17 ms 792 KB Output is correct
3 Correct 19 ms 876 KB Output is correct
4 Correct 55 ms 2428 KB Output is correct
5 Correct 56 ms 2420 KB Output is correct
6 Correct 55 ms 2536 KB Output is correct
7 Correct 59 ms 2504 KB Output is correct
8 Correct 69 ms 2676 KB Output is correct
9 Correct 76 ms 2792 KB Output is correct
10 Correct 63 ms 2756 KB Output is correct
11 Correct 77 ms 3076 KB Output is correct
12 Correct 70 ms 2964 KB Output is correct
13 Correct 72 ms 2932 KB Output is correct
14 Correct 71 ms 2928 KB Output is correct
15 Correct 79 ms 2948 KB Output is correct
16 Correct 82 ms 3328 KB Output is correct
17 Correct 78 ms 3396 KB Output is correct
18 Correct 70 ms 2540 KB Output is correct
19 Correct 57 ms 2532 KB Output is correct
20 Correct 56 ms 2456 KB Output is correct
21 Correct 124 ms 4916 KB Output is correct
22 Correct 130 ms 4888 KB Output is correct
23 Correct 131 ms 4896 KB Output is correct
24 Correct 115 ms 4856 KB Output is correct
25 Correct 113 ms 4932 KB Output is correct
26 Correct 136 ms 5684 KB Output is correct
27 Correct 162 ms 5660 KB Output is correct
28 Correct 82 ms 3856 KB Output is correct
29 Correct 87 ms 3692 KB Output is correct
30 Correct 90 ms 4044 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 516 KB Output is correct
2 Correct 17 ms 792 KB Output is correct
3 Correct 19 ms 876 KB Output is correct
4 Correct 55 ms 2428 KB Output is correct
5 Correct 56 ms 2420 KB Output is correct
6 Correct 55 ms 2536 KB Output is correct
7 Correct 59 ms 2504 KB Output is correct
8 Correct 69 ms 2676 KB Output is correct
9 Correct 76 ms 2792 KB Output is correct
10 Correct 63 ms 2756 KB Output is correct
11 Correct 77 ms 3076 KB Output is correct
12 Correct 70 ms 2964 KB Output is correct
13 Correct 72 ms 2932 KB Output is correct
14 Correct 71 ms 2928 KB Output is correct
15 Correct 79 ms 2948 KB Output is correct
16 Correct 82 ms 3328 KB Output is correct
17 Correct 78 ms 3396 KB Output is correct
18 Correct 70 ms 2540 KB Output is correct
19 Correct 57 ms 2532 KB Output is correct
20 Correct 56 ms 2456 KB Output is correct
21 Correct 124 ms 4916 KB Output is correct
22 Correct 130 ms 4888 KB Output is correct
23 Correct 131 ms 4896 KB Output is correct
24 Correct 115 ms 4856 KB Output is correct
25 Correct 113 ms 4932 KB Output is correct
26 Correct 136 ms 5684 KB Output is correct
27 Correct 162 ms 5660 KB Output is correct
28 Correct 82 ms 3856 KB Output is correct
29 Correct 87 ms 3692 KB Output is correct
30 Correct 90 ms 4044 KB Output is correct
31 Correct 589 ms 23860 KB Output is correct
32 Correct 590 ms 23804 KB Output is correct
33 Correct 602 ms 23824 KB Output is correct
34 Correct 599 ms 24248 KB Output is correct
35 Correct 569 ms 23760 KB Output is correct
36 Correct 701 ms 29492 KB Output is correct
37 Correct 702 ms 29444 KB Output is correct
38 Correct 451 ms 18212 KB Output is correct
39 Correct 418 ms 18192 KB Output is correct
40 Correct 423 ms 18084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 644 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -