mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 15:56:26 +00:00
parent
ea9baef29c
commit
865f73704c
43
LibreOJ/2884/2884.cpp
Normal file
43
LibreOJ/2884/2884.cpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cstring>
|
||||||
|
#include <functional>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout;
|
||||||
|
const char endl = '\n';
|
||||||
|
|
||||||
|
const int N = 2005;
|
||||||
|
|
||||||
|
int n, f[N][N], ans;
|
||||||
|
std::pair<int, int> a[N];
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::ios::sync_with_stdio(false);
|
||||||
|
cin.tie(nullptr);
|
||||||
|
|
||||||
|
cin >> n;
|
||||||
|
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
cin >> a[i].first >> a[i].second;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::sort(a + 1, a + 1 + n, std::greater<>());
|
||||||
|
memset(f, 0xc0, sizeof(f));
|
||||||
|
|
||||||
|
f[0][1] = 0;
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
for (int j = 0; j <= n; j++) {
|
||||||
|
f[i][j] = std::max(f[i - 1][j], f[i - 1][std::max(j - a[i].first, 0) + 1] + a[i].second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i <= n; i++) {
|
||||||
|
ans = std::max(ans, f[n][i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << ans << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
LibreOJ/2884/data/01-01.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-01.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-01.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-01.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-02.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-02.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-02.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-02.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-03.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-03.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-03.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-03.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-04.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-04.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-04.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-04.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-05.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-05.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-05.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-05.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-06.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-06.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-06.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-06.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-07.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-07.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-07.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-07.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-08.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-08.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-08.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-08.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-09.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-09.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-09.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-09.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-10.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-10.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-10.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-11.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-11.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-11.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-12.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-12.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-12.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-13.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-13.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-13.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-14.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-14.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-14.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-15.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-15.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-15.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-16.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-16.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-16.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-17.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-17.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-17.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-18.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-18.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-18.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-19.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-19.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-19.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-20.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-20.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-20.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-21.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-21.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-21.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-22.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-22.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-22.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-23.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-23.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-23.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-24.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-24.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-24.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-25.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-25.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/01-25.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/01-25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-01.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-01.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-01.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-01.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-02.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-02.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-02.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-02.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-03.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-03.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-03.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-03.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-04.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-04.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-04.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-04.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-05.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-05.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-05.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-05.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-06.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-06.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-06.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-06.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-07.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-07.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-07.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-07.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-08.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-08.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-08.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-08.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-09.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-09.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-09.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-09.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-10.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-10.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-10.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-11.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-11.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-11.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-12.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-12.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-12.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-13.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-13.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-13.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-14.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-14.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-14.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-15.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-15.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-15.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-16.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-16.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-16.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-17.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-17.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-17.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-18.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-18.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-18.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-19.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-19.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-19.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-20.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-20.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-20.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-21.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-21.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-21.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-22.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-22.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-22.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-23.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-23.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-23.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-24.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-24.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-24.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2884/data/02-25.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2884/data/02-25.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user