QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#434246 | #8768. Arrested Development | ucup-team3691# | WA | 248ms | 990464kb | C++17 | 892b | 2024-06-08 15:16:54 | 2024-06-08 15:16:54 |
Judging History
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'