제출 #751428

#제출 시각아이디문제언어결과실행 시간메모리
751428tolbiPacking Biscuits (IOI20_biscuits)C++17
12 / 100
1 ms340 KiB
#pragma optimize("Bismillahirrahmanirrahim") //█▀█─█──█──█▀█─█─█ //█▄█─█──█──█▄█─█■█ //█─█─█▄─█▄─█─█─█─█ //Allahuekber //ahmet23 orz... //Sani buyuk Osman Pasa Plevneden cikmam diyor. //FatihSultanMehmedHan //YavuzSultanSelimHan //AbdulhamidHan #define author tolbi #include <bits/stdc++.h> using namespace std; template<typename X, typename Y> istream& operator>>(istream& in, pair<X,Y> &pr) {return in>>pr.first>>pr.second;} template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr) {return os<<pr.first<<" "<<pr.second;} template<typename X> istream& operator>>(istream& in, vector<X> &arr) {for(auto &it : arr) in>>it; return in;} template<typename X> ostream& operator<<(ostream& os, vector<X> arr) {for(auto &it : arr) os<<it<<" "; return os;} template<typename X, size_t Y> istream& operator>>(istream& in, array<X,Y> &arr) {for(auto &it : arr) in>>it; return in;} template<typename X, size_t Y> ostream& operator<<(ostream& os, array<X,Y> arr) {for(auto &it : arr) os<<it<<" "; return os;} #define int long long #define endl '\n' #define vint(x) vector<int> x #define deci(x) int x;cin>>x; #define decstr(x) string x;cin>>x; #define cinarr(x) for (auto &it : x) cin>>it; #define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl; #define sortarr(x) sort(x.begin(),x.end()) #define sortrarr(x) sort(x.rbegin(),x.rend()) #define det(x) cout<<"NO\0YES"+x*3<<endl; #define INF LONG_LONG_MAX #define rev(x) reverse(x.begin(),x.end()); #define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define tol(bi) (1LL<<((int)(bi))) const int MOD = 1e9+7; mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count()); #ifdef tolbi #else #include "biscuits.h" #endif long long count_tastiness(long long x, vector<long long> arr) { int n = arr.size(); vector<int> bosl(n); int somma = 0; int crr = 0; int ca = 0; for (int i = 0; i < n; i++){ int kal = arr[i]; while (kal){ while (ca<n && somma+tol(i)>=tol(ca)){ if (ca<=i){ bosl[ca]=crr+(tol(ca)-somma-1); if (!arr[ca]) bosl[ca]++; } else { bosl[ca]=bosl[ca-1]*2; } ca++; } if (ca<n && somma+kal*tol(i)>=tol(ca)){ int ara = (tol(ca)-somma)/tol(i); while (ara*tol(i)+somma<tol(ca)) ara++; while (ara*tol(i)+somma>=tol(ca)) ara--; kal-=ara; crr+=bosl[i]*ara; somma+=tol(i)*ara; } else { somma+=kal*tol(i); crr+=kal*bosl[i]; kal=0; } } } return somma-crr+1; } #ifdef tolbi int32_t main() { int32_t q; assert(scanf("%d", &q) == 1); vector<int32_t> k(q); vector<long long> x(q); vector<vector<long long>> a(q); vector<long long> results(q); for (int32_t t = 0; t < q; t++) { assert(scanf("%d%lld", &k[t], &x[t]) == 2); a[t] = vector<long long>(k[t]); for (int32_t i = 0; i < k[t]; i++) { assert(scanf("%lld", &a[t][i]) == 1); } } fclose(stdin); for (int32_t t = 0; t < q; t++) { results[t] = count_tastiness(x[t], a[t]); } for (int32_t t = 0; t < q; t++) { printf("%lld\n", results[t]); } fclose(stdout); return 0; } #endif

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

biscuits.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Bismillahirrahmanirrahim")
      |
#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...