Submission #474113

# Submission time Handle Problem Language Result Execution time Memory
474113 2021-09-16T23:55:34 Z Cross_Ratio Packing Biscuits (IOI20_biscuits) C++14
0 / 100
1000 ms 356 KB
//#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
long long cnt = 0;
long long int X;
long long int backtrack(int N, vector<long long> A) {
    long long int ans = 0;
    vector<long long> A1 = A;
    if(A1[N] >= X) {
        A1[N] -= X;
        if(N == A1.size() - 1) A1.push_back(A1[N]/2);
        else A1[N+1] += A1[N]/2;
        ans += backtrack(N+1,A1);
    }
    if(N == A.size() - 1) {
        if(A[N] == 0 || A[N] == 1) return 1;
        A.push_back(A[N]/2);
    }
    else A[N+1] += A[N] / 2;
    ans += backtrack(N+1,A);
    //cout << N <<" : " << ans << '\n';
    return ans;
}
long long count_tastiness(long long x, vector<long long> a) {
    X = x;
	return backtrack(0,a);
}

Compilation message

biscuits.cpp: In function 'long long int backtrack(int, std::vector<long long int>)':
biscuits.cpp:11:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |         if(N == A1.size() - 1) A1.push_back(A1[N]/2);
      |            ~~^~~~~~~~~~~~~~~~
biscuits.cpp:15:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     if(N == A.size() - 1) {
      |        ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 296 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1077 ms 356 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -