Submission #237846

#TimeUsernameProblemLanguageResultExecution timeMemory
237846wiwihoSemiexpress (JOI17_semiexpress)C++14
18 / 100
5 ms384 KiB
//#define NDEBUG #include <bits/stdc++.h> #include <bits/extc++.h> #define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define iter(a) a.begin(), a.end() #define riter(a) a.rbegin(), a.rend() #define lsort(a) sort(iter(a)) #define gsort(a) sort(riter(a)) #define pb(a) push_back(a) #define eb(a) emplace_back(a) #define pf(a) push_front(a) #define pob pop_back() #define pof pop_front() #define mp(a, b) make_pair(a, b) #define F first #define S second #define mt make_tuple #define gt(t, i) get<i>(t) #define iceil(a, b) ((a + b - 1) / b) #define tomax(a, b) (a = max(a, b)) #define printv(a, b) {bool pvaspace=false; \ for(auto pva : a){ \ if(pvaspace) b << " "; pvaspace=true;\ b << pva;\ }\ b << "\n";} //#define TEST using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef unsigned long long ull; typedef long double ld; using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<ld, ld>; using tiii = tuple<int, int, int>; const ll MOD = 1000000007; const ll MAX = 2147483647; template<typename A, typename B> ostream& operator<<(ostream& o, pair<A, B> p){ return o << '(' << p.F << ',' << p.S << ')'; } int main(){ StarBurstStream ll n, m, k; cin >> n >> m >> k; ll a, b, c; cin >> a >> b >> c; ll t; cin >> t; vector<ll> s(m); for(int i = 0; i < m; i++) cin >> s[i], s[i]--; ll ans = 0; vector<ll> tmp; for(int i = 0; i < m - 1 && s[i] * b <= t; i++){ ll st = s[i]; ll ed = (t - st * b) / a; ed = min(ed, s[i + 1] - s[i] - 1); // cerr << st << " " << ed << "\n"; ans += ed + 1; ll semi = ed + 1; while(tmp.size() < k - m && s[i] + semi < s[i + 1] && st * b + semi * c <= t){ ll e = (t - st * b - semi * c) / a; e = min(e, s[i + 1] - (s[i] + semi) - 1); // cerr << "semi " << semi << " " << e << "\n"; tmp.eb(e + 1); semi += e + 1; } } if(b * (n - 1) <= t) ans++; ans--; gsort(tmp); for(int i = 0; i < k - m && i < tmp.size(); i++){ ans += tmp[i]; } cout << ans << "\n"; return 0; }

Compilation message (stderr)

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:79:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while(tmp.size() < k - m && s[i] + semi < s[i + 1] && st * b + semi * c <= t){
               ~~~~~~~~~~~^~~~~~~
semiexpress.cpp:93:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < k - m && i < tmp.size(); i++){
                                 ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...