Submission #237846

# Submission time Handle Problem Language Result Execution time Memory
237846 2020-06-09T02:18:34 Z wiwiho Semiexpress (JOI17_semiexpress) C++14
18 / 100
5 ms 384 KB
//#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

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 time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 320 KB Output is correct
15 Incorrect 4 ms 384 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 320 KB Output is correct
15 Incorrect 4 ms 384 KB Output isn't correct
16 Halted 0 ms 0 KB -