Submission #488566

# Submission time Handle Problem Language Result Execution time Memory
488566 2021-11-19T16:42:57 Z AmirElarbi Packing Biscuits (IOI20_biscuits) C++14
0 / 100
1 ms 340 KB
#include <bits/stdc++.h>
#include "biscuits.h"
#define vi vector<int>
#define ve vector
#define ll long long
#define vf vector<float>
#define vll vector<pair<ll,ll>>
#define ii pair<int,int>
#define vvi vector<vi>
#define vii vector<ii>
#define gii greater<ii>
#define pb push_back
#define fi first
#define se second
#define INF 1e8
#define eps 1e-7
#define eps1 1e-25
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX_A 1e5+5
#define V 450
using namespace std;
const int MOD = 1e9+7;
const int nax = 100005;
int s[64];
ll count_tastiness(ll x, ve<ll> a){
    for (int i = 0; i < a.size(); ++i)
    {
        s[i] = a[i];
    }
    for (int i = 0; i < 64; ++i)
    {
        if(s[i] >= 3){
            if(s[i]%2 == 1){
                s[i+1] += s[i]/2; 
                s[i] = 1;
            } else {
                s[i+1] += (s[i]-1)/2;
                s[i] = 2;
            }
        }
    }
    int res = 1, cur = 0;
    for (int i = 0; i < a.size(); ++i)
    {
        if(a[i] == 0){
            res *= cur;
            cur = 0;
        }
        else {
            cur += a[i]*pow(2,i);
        }
    }
    return res;
}

Compilation message

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:26:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for (int i = 0; i < a.size(); ++i)
      |                     ~~^~~~~~~~~~
biscuits.cpp:43:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |     for (int i = 0; i < a.size(); ++i)
      |                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -