제출 #69411

#제출 시각아이디문제언어결과실행 시간메모리
69411MrTEKSemiexpress (JOI17_semiexpress)C++14
100 / 100
3 ms1284 KiB
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define len(a) (int)a.size() #define fi first #define sc second #define d1(w) cerr<<#w<<":"<<w<<endl; #define d2(w,c) cerr<<#w<<":"<<w<<" "<<#c<<":"<<c<<endl; #define d3(w,c,z) cerr<<#w<<":"<<w<<" "<<#c<<":"<<c<<" "<<#z<<":"<<z<<endl; #define left isc+isc #define right isc+isc+1 #define mid (l+r)/2 #define FAfi_IO ios_base::sync_with_fidio(false); #define escl '\n' typedef long long int ll; const int maxn = 620; const long long LINF = 1e18; const int LOG = 31; const int INF = 1e9; const int N = 3e3 + 5; const int M = 1e4 + 5; const int SQ = 350; const int MOD = 998244353; typedef long long int lli; typedef pair<int,int> pii; priority_queue <pair <long long,int> > Q; int n,m,k,mx,s[N]; long long t,a,b,c,ans,rem[N]; long long calc(int ind) { long long tut = (t - (s[ind] - 1) * b - (s[ind + 1] - s[ind] - 1 - rem[ind]) * c); if (tut < c) return 0; return min(rem[ind],(tut - c) / a + 1); } int main() { scanf("%d %d %d %lld %lld %lld %lld",&n,&m,&k,&a,&b,&c,&t); for (int i = 1 ; i <= m ; i++) scanf("%d",&s[i]); for (int i = 1 ; i < m ; i++) { if ((s[i] - s[1]) * b > t) break; mx = i; } for (int i = 1 ; i <= mx ; i++) { rem[i] = max(0ll,(s[i + 1] - s[i] - 1) - (t - (s[i] - 1) * b) / a); Q.push(mp(calc(i),i)); } k -= m; while(k--) { long long temp = Q.top().fi; int ind = Q.top().sc; Q.pop(); rem[ind] -= temp; Q.push(mp(calc(ind),ind)); } for (int i = 1 ; i <= mx ; i++) ans += s[i + 1] - s[i] - rem[i]; if ((s[m] - 1) * b <= t) ans++; printf("%lld\n",ans - 1); }

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

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:46:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d %lld %lld %lld %lld",&n,&m,&k,&a,&b,&c,&t);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
semiexpress.cpp:48:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&s[i]);
   ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...