(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

제출 #1083117

#제출 시각아이디문제언어결과실행 시간메모리
1083117beaconmc비스킷 담기 (IOI20_biscuits)C++14
9 / 100
1018 ms432 KiB
#include "biscuits.h" #include <bits/stdc++.h> typedef long long ll; #define FOR(i,x,y) for(ll i=x; i<y; i++) #define FORNEG(i,x,y) for(ll i=x; i>y; i--) using namespace std; vector<ll> A(18); ll X; // unordered_map<ll,ll> dps; // ll hashs(ll a, ll b){ // return b*18 + a; // } // ll cnt = 0; // ll dp(ll pos, ll add){ // cnt++; // if (dps.count(hashs(pos, add))) return dps[hashs(pos, add)]; // if (pos>=A.size()) return 1; // ll temp = 0; // if (add==0){ // ll cur = 0; // while (cur <= X && cur <= A[pos]){ // temp += dp(pos+1, (A[pos]-cur)/2); // cur += X; // } // }else{ // ll idk = (A[pos] + add); // ll cur = 0; // while (cur <= X && cur <= idk){ // temp += dp(pos+1, (idk-cur)/2); // cur += X; // } // } // dps[hashs(pos, add)] = temp; // return temp; // } long long count_tastiness(long long x, std::vector<long long> a) { X = x; FOR(i,0,18) A[i] = 0; // dps.clear(); // dps.reserve(1<<19); FOR(i,0,a.size()) A[i] = a[i]; ll ans = 0; FOR(cnt,0,200001){ ll carry = 0; bool flag = false; FOR(i,0,18){ carry += A[i]; if (cnt & (1<<i)){ if (carry < x){ flag = true; break; } carry -= x; } carry /= 2; } if (!flag) ans++; } return ans; }

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

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:5:33: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define FOR(i,x,y) for(ll i=x; i<y; i++)
......
   52 |  FOR(i,0,a.size()) A[i] = a[i];
      |      ~~~~~~~~~~~~                
biscuits.cpp:52:2: note: in expansion of macro 'FOR'
   52 |  FOR(i,0,a.size()) A[i] = a[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...