Submission #1296019

#TimeUsernameProblemLanguageResultExecution timeMemory
1296019lukaye_19Packing Biscuits (IOI20_biscuits)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

int count_tastiness(long long x, long long arr[])
{
  long long* a = arr;
  long long k = sizeof(a) / sizeof(a[0]);
  
  long long totaltastiness = 0;
  long long returnvalue = 0;
  
  for (long long i = 0; i < k; i++)
  {
    long long totalcookies = a[i];
    
    totaltastiness += pow(2,i) * totalcookies;
  }
  
  for (long long i = 0; i < totaltastiness / x + 1; i++)
  {
    unordered_set<int>usedcookies;
    bool validtastevalue = true;
    
    for (long long j = 0; j < x; j++)
    {
      for (long long n = 0; n < pow(2,k); n++)
      {
        int cookievalue = 0;
        int asciivalue = n;
        
        for (long long m = k - 1; m >= 0; m--)
        {
          auto it = usedcookies.find(m);
          
          if (it == usedcookies.end())
          {
            break;
          }
          
          int currentpower = pow(2,m);
          
          if (currentpower <= asciivalue)
          {
            cookievalue += a[m];
          }
        }
        
        if (cookievalue == i)
        {
          for (long long m = k - 1; m >= 0; m--)
          {
            usedcookies.insert(m);
          }
        }
        else
        {
          validtastevalue = false;
        }
      }
    }
    
    if (validtastevalue)
    {
      returnvalue++;
    }
  }
  
  return returnvalue;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccnZHstw.o: in function `main':
grader.cpp:(.text.startup+0x4f7): undefined reference to `count_tastiness(long long, std::vector<long long, std::allocator<long long> >)'
collect2: error: ld returned 1 exit status