Submission #415505

# Submission time Handle Problem Language Result Execution time Memory
415505 2021-06-01T07:44:20 Z MKopchev Packing Biscuits (IOI20_biscuits) C++14
42 / 100
1000 ms 43456 KB
#include "biscuits.h"
#include<bits/stdc++.h>
using namespace std;

const int nmax=64;

long long inp[nmax],mem_x;

unordered_map<long long,long long> seen[nmax];

long long rec(int bit,long long high)
{
    if(bit==60)return 1;

    high=high+inp[bit];

    if(seen[bit].count(high))return seen[bit][high];

    long long ret=0;
    //0
    ret=ret+rec(bit+1,high/2);
    //1
    if(high>=mem_x)ret=ret+rec(bit+1,(high-mem_x)/2);

    seen[bit][high]=ret;

    //cout<<"f "<<bit<<" , "<<high<<" = "<<ret<<endl;

    return ret;
}
long long count_tastiness(long long x, std::vector<long long> a) {
    mem_x=x;

	for(int i=0;i<60;i++)
    {
        seen[i]={};
        inp[i]=0;
    }
    for(int i=0;i<a.size();i++)inp[i]=a[i];

    long long ret=rec(0,0);

    //for(int i=0;i<59;i++)cout<<i<<" -> "<<seen[i].size()<<endl;

    return ret;
}
/*
int main() {
	int q;
	assert(scanf("%d", &q) == 1);
	vector<int> k(q);
	vector<long long> x(q);
	vector<vector<long long>> a(q);
	vector<long long> results(q);
	for (int t = 0; t < q; t++) {
		assert(scanf("%d%lld", &k[t], &x[t]) == 2);
		a[t] = vector<long long>(k[t]);
		for (int i = 0; i < k[t]; i++) {
			assert(scanf("%lld", &a[t][i]) == 1);
		}
	}
	fclose(stdin);

	for (int t = 0; t < q; t++) {
		results[t] = count_tastiness(x[t], a[t]);
	}
	for (int t = 0; t < q; t++) {
		printf("%lld\n", results[t]);
	}
	fclose(stdout);
	return 0;
}
*/

Compilation message

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:39:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for(int i=0;i<a.size();i++)inp[i]=a[i];
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 2 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 13852 KB Output is correct
2 Correct 143 ms 7492 KB Output is correct
3 Correct 254 ms 12036 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 784 ms 14404 KB Output is correct
9 Correct 452 ms 10448 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 7 ms 504 KB Output is correct
12 Correct 76 ms 2820 KB Output is correct
13 Correct 734 ms 14440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 43456 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 2 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 2 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 91 ms 13852 KB Output is correct
25 Correct 143 ms 7492 KB Output is correct
26 Correct 254 ms 12036 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 784 ms 14404 KB Output is correct
32 Correct 452 ms 10448 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 7 ms 504 KB Output is correct
35 Correct 76 ms 2820 KB Output is correct
36 Correct 734 ms 14440 KB Output is correct
37 Execution timed out 1090 ms 43456 KB Time limit exceeded
38 Halted 0 ms 0 KB -