# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
875987 | 2023-11-21T02:31:04 Z | ReLice | Semiexpress (JOI17_semiexpress) | C++14 | 0 ms | 348 KB |
#include <bits/stdc++.h> #define ll long long #define ld long double #define pb push_back #define endl "\n" #define fr first #define sc second #define sz size() #define ins insert #define bc back() #define str string #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> void fre(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);} void start(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } const ll inf=1e18+7; const ll mod=1e9; const ll N=2e5+7; const ld eps=1e-9; void solve(){ ll i,j; ll n,m,k,a,b,c,t,ans=0; cin>>n>>m>>k>>a>>b>>c>>t; vector<ll> v(m,0),d(m,0); for(i=0;i<m;i++){ cin>>v[i]; d[i]=(v[i]-1)*b; if(d[i]>0 && d[i]<=t)ans++; } k-=m; vector<ll> vv; for(i=0;i<m-1;i++){ if(d[i]>t)break; ans+=min((t-d[i])/a,v[i+1]-v[i]-1); if((t-d[i])/a>=v[i+1]-v[i])continue; ll x=v[i]+(t-d[i])/a+1,dd; for(j=0;j<k;j++){ dd=(t-d[i]-(x-v[i])*c); if(dd<0 || x==v[i+1])break; vv.pb(min(dd/a+1,v[i+1]-x)); x+=dd/a+1; } } sort(rall(vv)); for(i=0;i<k && i<(ll)vv.sz;i++){ ans+=vv[i]; }cout<<ans<<endl; } signed main(){ start(); //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); ll t=1; //cin>>t; while(t--) solve(); } /* */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Incorrect | 0 ms | 348 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Incorrect | 0 ms | 348 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |