Submission #615470

# Submission time Handle Problem Language Result Execution time Memory
615470 2022-07-31T09:38:33 Z 장태환(#8493) Broken Device 2 (JOI22_device2) C++17
0 / 100
20 ms 940 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 0 ms 512 KB Output is correct
2 Incorrect 20 ms 940 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 512 KB Output is correct
2 Incorrect 20 ms 940 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 512 KB Output is correct
2 Incorrect 20 ms 940 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 512 KB Output is correct
2 Incorrect 20 ms 940 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 512 KB Output is correct
2 Incorrect 20 ms 940 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 656 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -