제출 #860577

#제출 시각아이디문제언어결과실행 시간메모리
860577mychecksedad비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1065 ms12764 KiB
// #include<biscuits.h> #include<bits/stdc++.h> using namespace std; #define ll long long int #define MOD (1000000000+7) #define MOD1 (998244353) #define pb push_back #define all(x) x.begin(), x.end() #define en cout << '\n' const int N = 1e6+100, M = 1e5+10, K = 22; ll count_tastiness(ll x, vector<ll> a){ for(int i = 0; i < 60; ++i) a.pb(0); int n = a.size(); for(int i = 0; i < n; ++i){ if(a[i] >= x){ a[i + 1] += (a[i]-x)>>1; a[i] = x; } } ll ans = 1; vector<array<ll, 2>> p; p.pb({0ll, 1ll}); for(int i = 0; i < n; ++i){ vector<array<ll, 2>> pp, pp2; for(auto z: p){ ll y = z[0]; if(pp.empty() || pp.back()[0] != ((y+a[i])>>1)){ pp.pb({(y+a[i])>>1, z[1]}); }else if(pp.back()[0] == ((y+a[i])>>1)){ pp.back()[1] += z[1]; } if((y+a[i]-x) >= 0){ if(pp2.empty() || pp2.back()[0] != ((y+a[i]-x)>>1)){ pp2.pb({(y+a[i]-x)>>1, z[1]}); }else if(pp2.back()[0] == ((y+a[i]-x)>>1)){ pp2.back()[1] += z[1]; } ans += z[1]; // pp[(y+a[i]-x)>>1] += z.second; // ans += z.second; } } p.clear(); int po = 0; for(int j = 0; j < pp.size(); ++j){ while(po < pp2.size() && pp2[po][0] < pp[j][0]){ p.pb(pp2[po]); ++po; } p.pb(pp[j]); if(po < pp2.size() && pp2[po][0] == p.back()[0]){ p.back()[1] += pp2[po][1]; ++po; } } // for(auto f: p) cout << f << ' '; // en; // cout << ans << '\n'; } // cout << s << ' '; // cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" seconds\n"; return ans; }

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

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:51:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<long long int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |   for(int j = 0; j < pp.size(); ++j){
      |                  ~~^~~~~~~~~~~
biscuits.cpp:52:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<long long int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |    while(po < pp2.size() && pp2[po][0] < pp[j][0]){
      |          ~~~^~~~~~~~~~~~
biscuits.cpp:57:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<long long int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |    if(po < pp2.size() && pp2[po][0] == p.back()[0]){
      |       ~~~^~~~~~~~~~~~
#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...