QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#497510#5005. GeekflixUmokWA 135ms3628kbC++201.4kb2024-07-29 11:56:072024-07-29 11:56:07

Judging History

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

  • [2024-07-29 11:56:07]
  • 评测
  • 测评结果:WA
  • 用时:135ms
  • 内存:3628kb
  • [2024-07-29 11:56:07]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define uint unsigned long long
#define int long long
#define endl '\n'
const int N = 1e4 + 5;
typedef pair<int, int> PII;
#define MAX LONG_LONG_MAX

struct node
{
    int a, b;
    bool operator<(const node &x) const
    {
        return a < x.a;
    }
};
int ar[N], br[N], ans = 0;
void solve()
{
    int n, m, ans = 0;
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        cin >> ar[i], ar[i + n] = ar[i];
    for (int i = 1; i <= n; i++)
        cin >> br[i], br[i + n] = br[i];

    for (int len = 1; len <= n; len++)
    {
        for (int l = 1, r = len; r <= 2 * n; l++, r++)
        {
            int have = m - min(l - 1, abs(n - r + 1)) - len + 1;
            
            priority_queue<node> q;
            int sum = 0;
            for (int i = l; i <= r; i ++)
                q.push({ar[i], br[i]});
            for (int i = 1; i <= have && !q.empty(); i++)
            {
                auto x = q.top();
                q.pop();
                if(x.a <= 0)
                    break;
                sum += x.a;
                x.a -= x.b;
                q.push(x);
            }
            ans = max(ans, sum);
        }
    }
    cout << ans << endl;
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);

    solve();
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3556kb

input:

3 10
10 10 10
5 3 1

output:

67

result:

ok single line: '67'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3504kb

input:

5 10
1 2 3 4 5
0 1 2 3 4

output:

16

result:

ok single line: '16'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

5 5
1 5000 1 1 5000
1 3000 1 1 3000

output:

10000

result:

ok single line: '10000'

Test #4:

score: -100
Wrong Answer
time: 135ms
memory: 3572kb

input:

100 500
1676 3766 611 4073 4277 633 1921 650 4074 4382 1027 1849 861 1199 1411 21 2021 2227 1829 2487 1415 4006 3680 2374 2332 1461 4384 3874 3053 2968 1347 4728 3085 3309 3800 2362 3941 2072 3011 4366 1454 4038 1214 3666 236 2624 38 3608 1202 1866 1094 2616 2223 4774 4989 4554 2586 724 3428 1990 43...

output:

824005

result:

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