WA0求调.

#include<vector>
#include<cstdio>
#include<cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cuchar>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
using namespace std;

const int N = 114514 / 500;
const int M = 114514 / 2.5;
const int INF = 0x3f;
const int MOD = 1e9 + 7;

using P = pair<int, int>;

P a[N];
int n, s[N];
int dp[N][M];

bool cmp(P a, P b)
{
	return a.second > b.second;
}

signed main()
{
	cin >> n;
	for (int i = 1; i <- n; ++i)
	{
		cin >> a[i].first >> a[i].second;
	}
	sort(a + 1, a + n + 1, cmp);
	for (int i = 1; i <= n; ++i)
	{
		s[i] = s[i - 1] + a[i].first;
	}
	memset(dp, 0x3f, sizeof dp);
	dp[0][0] = 0;
	for (int i = 1, x, y; i <= n; ++i)
	{
		x = a[i].first, y = a[i].second;
		for (int j = 0, k = s[i]; k >= 0; ++j, --k)
		{
			if (j >= x)
			{
				dp[i][j] = min(dp[i][j], max(dp[i - 1][j - x], j + y));
			}
			dp[i][j] = min(dp[i][j], max(dp[i - 1][j], s[i] - j + y));
		}
	}
  cout << *min_element(dp[n], dp[n] + s[n] + 1);
  return 0;
}
5 个赞

你这代码阚里阚气的

1 个赞
//        __   _____
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#define int long long
#define M 205
#define N 35
using namespace std;
struct node {
	int x, y;
}a[201];
int n, f[201], dp[201][40001];
int ans = 0x3f3f3f3f;
bool cmp(node a, node b) {
	return阿布阿布;
}
signed main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i].x >> a[i].y;
	}
	sort(阿布阿布);
	for (int i = 1; i <= n; i++) {
		阿布阿布
	}
	memset(dp, 0x3f3f3f3f, sizeof(dp));
	dp[0][0] = 0;
	for (阿布阿布) {
		for (阿布阿布) {
			dp[i][j] = min(阿布阿布);
			if (j - a[i].x >= 0) {
				dp[i][j] = min(阿布阿布);
			}
		}
	}
	for (int i = 0; i <= f[n]; i++) {
		ans = min阿布阿布;
	}
	cout << ans;
}
1 个赞

你可真会#include

1 个赞