QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#286806#7964. 转化_TLEer_WA 48ms23100kbC++142.1kb2023-12-18 17:23:472023-12-18 17:23:48

Judging History

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

  • [2023-12-18 17:23:48]
  • 评测
  • 测评结果:WA
  • 用时:48ms
  • 内存:23100kb
  • [2023-12-18 17:23:47]
  • 提交

answer

/*********************************************************************
    程序名:
    版权:
    作者:
    日期: 2023-12-17 12:09
    说明:
*********************************************************************/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <algorithm>
#include<bits/stdc++.h>

#define MAXN 351500

using namespace std;

int jmp[MAXN],ans[MAXN];
long long sum1 = 0, sum2 = 0;

struct node{
    int a,b,c,gx,bh;
    bool operator <(node d)const{
        return b+c<d.b+d.c;
    }
}a[MAXN];

int read() {
    int x = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')
        ch = getchar();
    while (ch >= '0' && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x;
}

int write(int x) {
    if (x >= 10) {
        write(x / 10);
    }
    putchar((x % 10) + '0');
    return 0;
}

priority_queue<node> q;

int main() {
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        a[i].a = read();a[i].bh=i;
    }
    for (int i = 1; i <= n; i++) {
        a[i].b = read();
    }
    for (int i = 1; i <= n; i++) {
        a[i].c = read();
    }

    for (int i = 1; i <= n; i++) {
        if(!a[i].a){jmp[i]=1;continue;}
        a[i].a+=a[i].c;a[i].c=0;
        sum1 += min(a[i].a, a[i].b);
        sum2 += a[i].a;
        ans[i]+=min(a[i].a, a[i].b);
        a[i].b-=min(a[i].a, a[i].b);
        a[i].a-=min(a[i].a, a[i].b);
        q.emplace(a[i]);
    }
    for(int i=1;i<=n;i++)
        if(jmp[i])
            q.emplace(a[i]);
    while(!q.empty()){
        auto rc=q.top();q.pop();
//        cout<<rc.b<<' '<<rc.c<<endl;
        if(!rc.b&&!rc.c)break;
        rc.a+=rc.c+1;a[rc.bh].a+=rc.c+1;
        
        sum1+=min(rc.a,rc.b);
        rc.gx+=min(rc.a,rc.b);
        sum2+=rc.c;
        ans[rc.bh]=rc.gx;
    }
    for (int i = 1; i <= n; i++) {
        write(sum1 - ans[i] + a[i].a);
        putchar(' ');
    }
    putchar('\n');
    write(sum2);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 48ms
memory: 23100kb

input:

351493
0 37836791 46095966 46912389 21595941 0 3 86568894 3 0 0 0 0 39910208 0 2 4 86885825 1 67660833 0 24488082 52447896 0 67190942 70457491 11166998 90470470 11095822 0 0 5 47222930 2 49736354 0 0 0 77339472 0 5 3 0 25347727 0 3 2 0 48844622 0 65142757 1 73733079 80634668 46683173 0 31644647 9760...

output:

126233789 / / , / + / / 5542728 . / / 109850050 / / 0 * / * / / / / ( / / / / / / / 0 / ) - - ' ' ' 114889784 - ( / - / ) + / / . / * / ) / / 0 / * / / ( / ( / + . , 75110918 / / / / / / / . ) / / , , ' / ' / ' , - 0 / * 0 / + 0 * / / 99010654 ( 0 ( , ( / / , - 68644747 * ) . ( / ) . / . 0 * ) / / /...

result:

wrong answer 1st lines differ - expected: '60073965049724 60073472376204 ...4 60073701685447 60073472376204', found: '126233789 / / , / + / / 554272... / / * / / / / ) + / - . / ( / '