Submission #707819

# Submission time Handle Problem Language Result Execution time Memory
707819 2023-03-10T08:54:10 Z Dan4Life Semiexpress (JOI17_semiexpress) C++17
0 / 100
1 ms 332 KB
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define int long long
#define sz(a) (int)a.size()
const int mxN = (int)3e3+10;
const int LINF = (int)2e18;
int n, m, k, A, B, C, T, ans, S[mxN];

int32_t main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m >> k >> A >> B >> C >> T; k-=m;
	for(int i = 0; i < m; i++) cin >> S[i];
	for(int i = 0; i < m; i++){
		int cost = (S[i]-1) * B; if(cost>T) break;
		ans++; if(i==m-1) break;
		int rem = T-cost; int done = rem/A;
		if(done>=S[i+1]-S[i]-1) done = min(done, S[i+1]-S[i]-1);
		int left = S[i+1]-S[i]-1-done; ans+=done;
		for(int l = S[i]+done+1; l < S[i+1] and k; l++){
			int cost2 = cost+(l-S[i])*C; if(cost2>T) break;
			k--; ans++;
			int As = min(S[i+1]-1-l, (T-cost2)/A);
			if(As) l+=As, ans+=As, cout << As << " ";
		}
	}
	cout << ans-1;
}

Compilation message

semiexpress.cpp: In function 'int32_t main()':
semiexpress.cpp:21:7: warning: unused variable 'left' [-Wunused-variable]
   21 |   int left = S[i+1]-S[i]-1-done; ans+=done;
      |       ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 332 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 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 332 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 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 332 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 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -