제출 #1296002

#제출 시각아이디문제언어결과실행 시간메모리
1296002lukaye_19비스킷 담기 (IOI20_biscuits)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; long long count_tastiness(long long x, long long a[]) { 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; }

컴파일 시 표준 에러 (stderr) 메시지

biscuits.cpp: In function 'long long int count_tastiness(long long int, long long int*)':
biscuits.cpp:6:24: warning: 'sizeof' on array function parameter 'a' will return size of 'long long int*' [-Wsizeof-array-argument]
    6 |   long long k = sizeof(a) / sizeof(a[0]);
      |                       ~^~
biscuits.cpp:4:50: note: declared here
    4 | long long count_tastiness(long long x, long long a[])
      |                                        ~~~~~~~~~~^~~
/usr/bin/ld: /tmp/ccj33zRe.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