답안 #841980

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
841980 2023-09-02T09:38:28 Z LucaIlie 비스킷 담기 (IOI20_biscuits) C++17
0 / 100
1000 ms 436 KB
#include "biscuits.h"
#include <bits/stdc++.h>

using namespace std;

vector <long long> biscuits;
long long solutions;

void countSolutions( int b, long long s, long long x ) {
    if ( b == biscuits.size() ) {
        solutions++;
        return;
    }

    countSolutions( b + 1, (biscuits[b] + s) / 2, x );
    if ( biscuits[b] + s >= x )
        countSolutions( b + 1, (biscuits[b] + s - x) / 2, x );
}

long long count_tastiness( long long x, vector <long long> a ) {
    const int k = 60;
    long long s;

    a.resize( k );
    biscuits.clear();

    s = 0;
    for ( int b = 0; b < k; b++ ) {
        a[b] += s;
        if ( a[b] > x ) {
            s = a[b] - x;
            a[b] = x + s % 2;
            s /= 2;
        } else
            s = 0;
        biscuits.push_back( a[b] );
    }

    countSolutions( 0, 0, x );

    return solutions;
}

Compilation message

biscuits.cpp: In function 'void countSolutions(int, long long int, long long int)':
biscuits.cpp:10:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     if ( b == biscuits.size() ) {
      |          ~~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1038 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1022 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -