Submission #1296025

#TimeUsernameProblemLanguageResultExecution timeMemory
1296025lukaye_19비스킷 담기 (IOI20_biscuits)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; long long count_tastiness(long long x, vector<long long> arr) { long long k = arr.size(); 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)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:13:30: error: 'a' was not declared in this scope
   13 |     long long totalcookies = a[i];
      |                              ^
biscuits.cpp:43:28: error: 'a' was not declared in this scope
   43 |             cookievalue += a[m];
      |                            ^