Submission #1069476

#TimeUsernameProblemLanguageResultExecution timeMemory
1069476HD1Packing Biscuits (IOI20_biscuits)C++14
12 / 100
1 ms348 KiB
#include "biscuits.h" #include <iostream> using namespace std; long long count_tastiness(long long x, std::vector<long long> a) { long long ans = 1; for(int i = 0;i < a.size(); i++){ if(a[i] > 2) { if(i == a.size()-1) a.push_back((a[i]-1)/2); else a[i+1] += (a[i]-1)/2; a[i] = a[i] - ((a[i]-1)/2)*2; } } a.push_back(0); long long ini = -1,suma = 0; for(int i = 0;i < a.size(); i++){ if(a[i]>0 && ini == -1) ini = i; if(a[i] == 2) suma += 1LL<<(i-ini); if(a[i] == 0 && ini != -1){ suma += 1LL << (i - ini); ini = -1; ans *= suma; suma = 0; } } return ans; }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:7:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for(int i = 0;i < a.size(); i++){
      |                   ~~^~~~~~~~~~
biscuits.cpp:9:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |             if(i == a.size()-1)
      |                ~~^~~~~~~~~~~~~
biscuits.cpp:19:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int i = 0;i < a.size(); i++){
      |                   ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...