QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#605560#8768. Arrested DevelopmentYshanqianWA 131ms1995912kbC++201.1kb2024-10-02 17:57:162024-10-02 17:57:16

Judging History

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

  • [2024-10-02 17:57:16]
  • 评测
  • 测评结果:WA
  • 用时:131ms
  • 内存:1995912kb
  • [2024-10-02 17:57:16]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define xx first
#define yy second
#define endl "\n"
#define pb push_back
#define int long long
#define ll long long
#define lowbit(x) x & (-x)
typedef pair<int, int> pii;
#define LF(x) fixed << setprecision(x)
#define Yshanqian ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
const int N = 5e6 + 10, M = 1010, inf = 0x3f3f3f3f, mod = 1e9 + 7, P = 13331;
int n;
int a[N], b[N];
int f[51][N];
void solve()
{
    cin >> n;
    memset(f, inf, sizeof f);
    f[0][0] = 0;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 0; j < N; j++)
        {
            if (j + a[i] < N)
                f[i][j + a[i]] = min(f[i][j + a[i]], f[i - 1][j]);
            f[i][j] = min(f[i][j], f[i - 1][j] + b[i]);
        }
    }
    int ans = inf;
    for (int i = 0; i < N; i++)
        ans = min(ans, max(i, f[n][i]));
    cout << ans << endl;
}
signed main()
{
    Yshanqian;
    int T;
    T = 1;
    // cin >> T;
    for (int cases = 1; cases <= T; ++cases)
    {
        // cout<<"Case #"<<cases<<": ";
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 131ms
memory: 1995912kb

input:

4
100 1
1 90
1 20
1 20

output:

0

result:

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