QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#523864#1140. Distributing Candiesgreen_gold_dog#0 77ms11824kbC++20711b2024-08-18 20:05:412024-08-18 20:05:41

Judging History

你现在查看的是最新测评结果

  • [2024-08-18 20:05:41]
  • 评测
  • 测评结果:0
  • 用时:77ms
  • 内存:11824kb
  • [2024-08-18 20:05:41]
  • 提交

answer

#include "candies.h"
#include <bits/stdc++.h>

using namespace std;

typedef int ll;

vector<ll> distribute_candies(vector<ll> c, vector<ll> l, vector<ll> r, vector<ll> v) {
	ll n = c.size(), q = v.size();
	vector<pair<ll, ll>> all;
	for (ll i = 0; i < n; i++) {
		all.emplace_back(c[i], i);
	}
	sort(all.begin(), all.end());
	ll ps = 0;
	for (ll i = 0; i < q; i++) {
		ps += v[i];
		if (ps < 0) {
			ps = 0;
		}
	}
	ll now = q, ns = 0;
	vector<ll> ans(n);
	for (ll i = 0; i < n; i++) {
		while (now > 0 && abs(ns) < all[i].first) {
			now--;
			ns += v[now];
		}
		if (abs(ns) >= all[i].first) {
			ans[all[i].second] = (ns < 0 ? 0 : all[i].first);
		} else {
			ans[all[i].second] = ps;
		}
	}
	return ans;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 3
Accepted
time: 0ms
memory: 3836kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
8
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000
8
0 7 1
0 7 1
0 7 300000000
0 7 994967293
0 7 1
0 7 1000000000
0 7 1000000000
0 7 1000000000

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000

result:

ok 3 lines

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 3828kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
10
283 43634 101056 10340 6009 5133 30 2 3677888 210
10
1 8 26416
2 7 -51219
2 4 17793
3 7 75426
3 7 22307
1 1 60258
3 7 -29824
0 8 24839
2 8 -60304
0 1 -26411

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 0 84084 0 0 0 0 0 84084 0

result:

wrong answer 3rd lines differ - expected: '0 17223 0 0 0 0 0 0 0 0', found: '0 0 84084 0 0 0 0 0 84084 0'

Subtask #2:

score: 0
Wrong Answer

Test #6:

score: 0
Wrong Answer
time: 77ms
memory: 11824kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
11408901 370732653 37843 28 53693 15782410 103 297546 1112427 170319071 26 1 6172 11614171 431 884673599 1 3 50085 154 57 28200 145886 898969 74758 72 845768 6 69787 11 31012465 55362 253 2363145 47186217 1103 19622 594 7867 1 4299 28130 48 4689582 12 ...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
11408901 370732653 37843 28 53693 15782410 103 297546 1112427 170319071 26 1 6172 11614171 431 884673599 1 3 50085 154 57 28200 145886 898969 74758 72 845768 6 69787 11 31012465 55362 253 2363145 47186217 1103 19622 594 7867 1 4299 28130 48 4689582 12 431 ...

result:

wrong answer 3rd lines differ - expected: '87153 87153 37843 28 53693 406...46468 9 1756 429030 247071 1629', found: '11408901 370732653 37843 28 53...3 9 1756 167542621 6854551 1629'

Subtask #3:

score: 0
Wrong Answer

Test #9:

score: 0
Wrong Answer
time: 1ms
memory: 3840kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1...

result:

wrong answer 3rd lines differ - expected: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0', found: '1000 1000 1000 1000 1000 1000 ...0 1000 1000 1000 1000 1000 1000'

Subtask #4:

score: 0
Wrong Answer

Test #16:

score: 0
Wrong Answer
time: 0ms
memory: 3884kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
10
11 440 51 41 11 1 3 108 148 14
10
0 9 60
0 9 -9
0 9 -30
0 9 41
0 9 82
0 9 69
0 9 -79
0 9 -39
0 9 72
0 9 41

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
11 208 51 41 11 1 3 108 148 14

result:

wrong answer 3rd lines differ - expected: '11 208 51 41 11 1 3 108 143 14', found: '11 208 51 41 11 1 3 108 148 14'

Subtask #5:

score: 0
Skipped

Dependency #1:

0%