QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#696804#8768. Arrested DevelopmentMiguel03121WA 25ms42344kbC++14833b2024-11-01 02:03:132024-11-01 02:03:13

Judging History

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

  • [2024-11-01 02:03:13]
  • 评测
  • 测评结果:WA
  • 用时:25ms
  • 内存:42344kb
  • [2024-11-01 02:03:13]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define F(i, a, b) for (int i = a; i < b; i++)
#define ALL(x) x.begin(), x.end()
#define IOS ios_base::sync_with_stdio(0)

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;

#define N 5000000

int main() {
  IOS;
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  int a, b;
  vector<int> options(N + 1, 1e8);
  options[0] = 0;
  F(j, 0, n) {
    cin >> a >> b;
    vector<int> tmp(N + 1, 1e8);

    F(i, 0, j * 100000 + 1) {
      tmp[i + a] = min(tmp[i + a], options[i]);
      tmp[i] = min(tmp[i], options[i] + b);
    }
    cout << endl;

    options = tmp;
  }

  int ans = 1e8;
  F(i, 0, N + 1) { ans = min(ans, max(options[i], i)); }
  cout << ans << '\n';
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 25ms
memory: 42344kb

input:

4
100 1
1 90
1 20
1 20

output:





3

result:

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