Submission #400973

# Submission time Handle Problem Language Result Execution time Memory
400973 2021-05-08T22:59:26 Z zoooma13 Packing Biscuits (IOI20_biscuits) C++14
0 / 100
2 ms 588 KB
#include "bits/stdc++.h"
#include "biscuits.h"
using namespace std;

vector <long long> a;
long long dp[2][64];
long long go(int i ,bool o){
    if(i == a.size())
        return 1;
    auto&ret = dp[o][i];
    if(~ret)
        return ret;
    if(!o && a[i] == 0) return ret = go(i+1 ,0);
    if(!o && a[i] == 1) return ret = 2*go(i+1 ,0);
    if(!o && a[i] == 2) return ret = 2*go(i+1 ,0) + go(i+1 ,1);
    if(o && a[i] == 0)  return ret = 2*go(i+1 ,0);
    if(o && a[i] == 1)  return ret = 2*go(i+1 ,0) + go(i+1 ,1);
    if(o && a[i] == 2)  return ret = 2*go(i+1 ,0) + 2*go(i+1 ,1);
}

long long count_tastiness(long long x, vector<long long> _a) {
    assert(x == 1);
    long long bef = 0;
    a = _a;
    a.resize(62);
    for(auto&i : a){
        i += bef;
        bef = (i-1)/2;
        i -= 2*bef;
    }
    memset(dp ,-1 ,sizeof dp);
    return go(0 ,0);
}

Compilation message

biscuits.cpp: In function 'long long int go(int, bool)':
biscuits.cpp:8:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     if(i == a.size())
      |        ~~^~~~~~~~~~~
biscuits.cpp:19:1: warning: control reaches end of non-void function [-Wreturn-type]
   19 | }
      | ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 588 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -