이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define ff first
#define ss second
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define rep1(i, a, b) for (int i = (int)a; i >= (int)b; --i)
#define mp make_pair
#define vii vector<vector<int>>
#define ll long long
ll count_tastiness(ll x, vector<ll> a) {
while (a.size() < 61) a.push_back(0);
vector<ll> s(61);
rep(i, 0, 60) {
if (i) s[i] = s[i - 1];
s[i] += a[i] * (1 << i);
}
vector<int> A;
A.push_back(0);
rep(i, 1, 60) {
ll mx = s[i - 1] / x;
ll base = (1ll << (i - 1));
//cout<<"s[i-1],i,base,mx="<<s[i-1]<<' '<<i<<' '<<base<<' '<<mx<<'\n';
for (int j = 0; base + A[j] <= mx; ++j) {
A.push_back(base + A[j]);
if (j == A.size() - 1) break;
}
}
// rep(i, 0, A.size() - 1) cout << A[i] << ' ';
// cout << '\n';
return A.size();
}
// int main() {
// long long x;
// vector<long long> v(61);
// cin >> x;
// rep(i, 0, 2) {
// cin >> v[i];
// }
// cout << count_tastiness(x, v);
// }
컴파일 시 표준 에러 (stderr) 메시지
biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:32:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
32 | if (j == A.size() - 1) break;
| ~~^~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |