Submission #169491

# Submission time Handle Problem Language Result Execution time Memory
169491 2019-12-20T17:01:34 Z combi1k1 Semiexpress (JOI17_semiexpress) C++14
0 / 100
2 ms 376 KB
#include<bits/stdc++.h>

using namespace std;

#define ll  long long
#define X   first
#define Y   second

#define all(x)  x.begin(),x.end()
#define sz(x)   (int)x.size()

#define pb      emplace_back
#define endl    "\n"

const ll    inf = 1e18;
const int   N   = 2e5 + 5;

typedef pair<int,int>   ii;

int main()  {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n, k, m;    cin >> n >> m >> k;
    ll  A, B, C;    cin >> A >> B >> C;

    ll  T;  cin >> T;

    vector<int> s(m);
    vector<ll>  pot;

    for(int i = 0 ; i < m ; ++i)    cin >> s[i];
    for(int i = 1 ; i < m ; ++i)    {
        ll  rem = T - B * (s[i - 1] - 1);
        int rig = s[i - 1];

        if (rem < 0)    {
            pot.pb(n);
            continue;
        }
        int Q = 1;

        while  (rig < s[i]) {
            ll  nxt = rig + rem / A + 1;

            if (nxt > s[i])
                nxt = s[i];

            int len = nxt - rig;    rig = nxt;
            pot.pb(len + Q * n);    Q = 0;

            cerr << len << " ";

            rem -= C * len;

            if (rem < 1)
                break;
        }
        cerr << "\n";
    }
    pot.pb(n + (B * (n - 1) <= T));

    sort(pot.begin(),pot.end(),greater<ll>());

    if (k > sz(pot))
        k = sz(pot);

    cout << accumulate(pot.begin(),pot.begin() + k,0ll) - 1ll * m * n << endl;
}
/*
300 8 16
345678901 123456789 234567890
12345678901
1
10
77
82
137
210
297
300
*/
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -