Submission #167894

#TimeUsernameProblemLanguageResultExecution timeMemory
167894theStaticMindSemiexpress (JOI17_semiexpress)C++14
100 / 100
20 ms6136 KiB
#include<bits/stdc++.h> #define mp make_pair #define pb push_back #define ii pair<int,int> #define all(x) (x).begin(),(x).end() #define INF 100000000000000000 #define modulo 1000000007 #define mod 998244353 #define int long long int using namespace std; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); // freopen("q.gir","r",stdin); // freopen("q.cik","w",stdout); int n,m,k,A,B,C,T,ans=-1; cin>>n>>m>>k>>A>>B>>C>>T;k-=m; vector<int>arr(m); vector<queue<int>>knap; vector<int>dp(k+1,0); for(int i=0;i<m;i++)cin>>arr[i]; for(int i=1;i<m;i++){ int L=arr[i-1]; int R=arr[i]; int time=(L-1)*B; int last=L; int put=0; int cnt=0; queue<int>Q; if(time>T)break; while(last<R&&put<=k&&time<=T){ int c=min((T-time)/A+1,R-last); cnt+=c; time+=c*C; if(put==0)ans+=c; else Q.push(c); put++; last+=c; } if(!Q.empty()) knap.pb(Q); } if((n-1)*B<=T)ans++; priority_queue<ii>Q; for(int i=0;i<knap.size();i++){ Q.push({knap[i].front(),i}); knap[i].pop(); } while(k--&&!Q.empty()){ ans+=Q.top().first; int x=Q.top().second; Q.pop(); if(!knap[x].empty()){ Q.push({knap[x].front(),x}); knap[x].pop(); } } cout<<ans; }

Compilation message (stderr)

semiexpress.cpp: In function 'int32_t main()':
semiexpress.cpp:47:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int i=0;i<knap.size();i++){
                   ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...