답안 #769965

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
769965 2023-06-30T15:19:44 Z gun_gan Semiexpress (JOI17_semiexpress) C++17
100 / 100
37 ms 16952 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int MX = 3005;

ll N, M, K;
ll A, B, C, T;
ll s[MX];

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

      cin >> N >> M >> K;
      cin >> A >> B >> C;
      cin >> T;

      for(int i = 1; i <= M; i++) cin >> s[i];

      ll ans = -1, cur = 0;
      K -= M;
      vector<ll> v;
      for(int i = 1; i < M; i++) {
            if(cur > T) break;

            ll ccur = cur, pos = s[i];
            for(int j = 0; j <= K; j++) {
                  if(ccur > T) break;
                  ll d = min(s[i + 1] - pos, (T - ccur) / A + 1);
                  
                  if(!j) ans += d;
                  else v.push_back(d);

                  if((T - ccur) / A + 1 >= s[i + 1] - s[i]) break;
                  ccur += C * d;
                  pos += d;
            }

            cur += B * (s[i + 1] - s[i]);
      }

      if(cur <= T) ans += 1;

      sort(v.rbegin(), v.rend());

      for(int i = 0; i < min(K, (ll) v.size()); i++) ans += v[i];

      cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 2 ms 724 KB Output is correct
23 Correct 37 ms 16952 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 328 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 9 ms 4544 KB Output is correct
30 Correct 6 ms 2512 KB Output is correct