QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#434246#8768. Arrested Developmentucup-team3691#WA 248ms990464kbC++17892b2024-06-08 15:16:542024-06-08 15:16:54

Judging History

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

  • [2024-06-08 15:16:54]
  • 评测
  • 测评结果:WA
  • 用时:248ms
  • 内存:990464kb
  • [2024-06-08 15:16:54]
  • 提交

answer

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

const int nmax = 50;
const int amax = 1e5;

int mint[nmax + 5][(nmax + 2) * (amax + 5)];

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

	for(int i = 0; i <= nmax; i++) {
		for(int j = 0; j <= amax; j++) {
			mint[i][j] = 1e9;
		}
	}

	int n; cin >> n;
	vector<pair<int, int>> v(n); for (auto &e : v) cin >> e.first >> e.second;

	mint[0][0] = 0;

	for(int i = 1; i <= n; i++) {
		for(int j = 0; j <= n * amax; j++) {
			mint[i][j + v[i - 1].first] = min(mint[i][j + v[i - 1].first], mint[i - 1][j]);
			mint[i][j] = min(mint[i][j], mint[i - 1][j] + v[i - 1].second);
		}
	}

	int best = 1e9;
	for(int time_a = 0; time_a <= n * amax; time_a++) {
		int time_b = mint[n][time_a];
		best = min(best, max(time_a, time_b));
	}

	cout << best << endl;
}

详细

Test #1:

score: 100
Accepted
time: 7ms
memory: 28336kb

input:

4
100 1
1 90
1 20
1 20

output:

3

result:

ok single line: '3'

Test #2:

score: 0
Accepted
time: 7ms
memory: 24740kb

input:

2
314 1
592 6

output:

7

result:

ok single line: '7'

Test #3:

score: 0
Accepted
time: 0ms
memory: 23700kb

input:

1
1 1

output:

1

result:

ok single line: '1'

Test #4:

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

input:

1
100000 1

output:

1

result:

ok single line: '1'

Test #5:

score: 0
Accepted
time: 0ms
memory: 23888kb

input:

1
1 100000

output:

1

result:

ok single line: '1'

Test #6:

score: 0
Accepted
time: 5ms
memory: 24040kb

input:

1
100000 100000

output:

100000

result:

ok single line: '100000'

Test #7:

score: -100
Wrong Answer
time: 248ms
memory: 990464kb

input:

50
78681 95291
22639 1538
12119 52253
50430 63757
66133 92826
61048 40069
33506 30382
96049 50134
42895 62735
86943 16955
9667 61843
49647 9320
29082 16909
69601 68436
19892 34306
29822 79462
73262 14568
1693 35040
89757 61888
56993 48750
89611 77773
54159 21067
32520 41091
52501 92770
36530 17589
5...

output:

100001

result:

wrong answer 1st lines differ - expected: '855897', found: '100001'