Submission #493264

#TimeUsernameProblemLanguageResultExecution timeMemory
493264BiazSemiexpress (JOI17_semiexpress)C++17
100 / 100
14 ms4540 KiB
#include <bits/stdc++.h> #define int long long //#define double long double #define Nanase_Kurumi_aka_menhera_chan_is_mine ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define pb push_back #define pi pair<int, int> #define ALL(i) i.begin(),i.end() #define gcd(i,j) __gcd(i,j) #define fi first #define se second #define eps 0.00000001 #define ist insert #define DNE nullptr //#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math") //#pragma GCC optimize("O2") int max(int x,int y){return x>=y?x:y;} int min(int x,int y){return x>=y?y:x;} using namespace std; typedef int ll; const int N=305; const int M=1000005; const int MOD=1000000007;//998244353; const int INF=1000000000000000000;//2147483647; inline void sol(){ int n,m,k,A,B,C,T; cin >>n>>m>>k>>A>>B>>C>>T; vector<int> s(m); for (int i=0;i<m;i++) cin >>s[i]; k-=m; int ans=0; vector<int> choose; for (int i=0;i<m-1;i++){ int cur=(s[i]-1)*B,p=s[i]; vector<int> tmp; while (cur<=T&&p<s[i+1]&&tmp.size()<(k+1)){ int nxt=min(p+(T-cur)/A,s[i+1]-1); tmp.pb(nxt-p+1); cur+=(nxt-p+1)*C; p=nxt+1; } if (tmp.size()){ ans+=tmp[0]; for (int i=1;i<tmp.size();i++) choose.pb(tmp[i]); } } sort(ALL(choose),greater<int>()); if ((s[m-1]-1)*B<=T) ans++; for (int i=0;i<min(k,choose.size());i++) ans+=choose[i]; --ans; // 1 can't cout <<ans<<'\n'; } signed main(){ Nanase_Kurumi_aka_menhera_chan_is_mine int _=1; //cin >>_; while (_--) sol(); return 0; }

Compilation message (stderr)

semiexpress.cpp: In function 'void sol()':
semiexpress.cpp:39:44: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   39 |         while (cur<=T&&p<s[i+1]&&tmp.size()<(k+1)){
      |                                  ~~~~~~~~~~^~~~~~
semiexpress.cpp:47:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |             for (int i=1;i<tmp.size();i++)
      |                          ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...