Submission #854609

# Submission time Handle Problem Language Result Execution time Memory
854609 2023-09-28T07:01:11 Z AaW Semiexpress (JOI17_semiexpress) C++14
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define AI(x) begin(x),end(x)
#define endl '\n'
#ifdef DEBUG 
#define debug(args...) LKJ("\033[1;32m[ "+string(#args)+" ]\033[0m", args)
template<class I> void LKJ(I&&x){ cerr << x << '\n'; }
template<class I, class...T> void LKJ(I&&x, T&&...t){ cerr << x << ", ", LKJ(t...); }
template<class I> void OI(I a, I b){ while(a < b) cerr << *a << " \n"[next(a) == b], ++a; }
#else
#define debug(...) 0
#define OI(...) 0
#endif
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


signed main() {_
	ll n, m, k; 
	cin >> n >> m >> k;
	ll a, b, c;
	cin >> a >> b >> c;
	vector<bool> fast(n+5);

	ll t; cin >> t;

	for (int i = 0; i < m; ++i) {
		int s; cin >> s;
		fast[s] = 1;
	}

	priority_queue<ll> pq;
	ll cnt = 0;
	ll lb = 1;
	vector<bool> ceed(n+5);
	for (ll i = 1; i < n; ++i) {
		if (fast[i+1]) lb = i;
		if (i * a <= t || lb*b + (i-lb)*a <= t){
			cnt++;
			debug("RRR", i);
			continue;
		} 
		if (ceed[i]) continue;
		ll cc = 0;
		for (ll j = i; j <= n; ++j) {
			if (fast[j+1]) break;
			if (lb*b + (i-lb)*c + (j-i)*a > t) break;
			cc++;
			ceed[j]=1;
		}
		debug(i, cc);
		pq.push(cc);
	}

	for (int i = 0; i < k - m; ++i) {
		if (pq.empty()) break;
		cnt += pq.top();
		pq.pop();
	}
	cout << cnt << endl;
}

Compilation message

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:13:20: warning: statement has no effect [-Wunused-value]
   13 | #define debug(...) 0
      |                    ^
semiexpress.cpp:41:4: note: in expansion of macro 'debug'
   41 |    debug("RRR", i);
      |    ^~~~~
semiexpress.cpp:13:20: warning: statement has no effect [-Wunused-value]
   13 | #define debug(...) 0
      |                    ^
semiexpress.cpp:52:3: note: in expansion of macro 'debug'
   52 |   debug(i, cc);
      |   ^~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -