QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#487097#7964. 转化lsflsf2023#WA 79ms7828kbC++141.4kb2024-07-22 16:13:422024-07-22 16:13:43

Judging History

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

  • [2024-07-22 16:13:43]
  • 评测
  • 测评结果:WA
  • 用时:79ms
  • 内存:7828kb
  • [2024-07-22 16:13:42]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

struct Ball
{
	int a, b, c;
}B[351500], C[351500];

int Min(int a, int b)
{
	return a < b ? a : b;
}

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 1 ; i <= n ; ++ i)
	  scanf("%d", &B[i].a);
	for (int i = 1 ; i <= n ; ++ i)
	  scanf("%d", &B[i].b);
	for (int i = 1 ; i <= n ; ++ i)
	  scanf("%d", &B[i].c);
    long long R1 = 0, R2 = 0;
    for (int i = 1 ; i <= n ; ++ i)
      if (B[i].a > 0)
        R1 += Min(B[i].a + B[i].c, B[i].b);
      else
        if (Min(B[i].b - 1, B[i].c) >= 0)
          R2 += Min(B[i].b - 1, B[i].c);
    for (int i = 1 ; i <= n ; ++ i)
      {
        if (B[i].a > 0)
          R1 -= Min(B[i].a + B[i].c, B[i].b);
        else
          if (Min(B[i].b - 1, B[i].c) >= 0)
            R2 -= Min(B[i].b - 1, B[i].c);
        if (R1 == 0 && B[i].a == 0)
          printf("0 ");
        else
          printf("%lld ", B[i].a + B[i].c + R1 + R2);
        if (B[i].a > 0)
          R1 += Min(B[i].a + B[i].c, B[i].b);
        else
          if (Min(B[i].b - 1, B[i].c) >= 0)
            R2 += Min(B[i].b - 1, B[i].c);
	  }
	bool Flag = false;
	long long Ans = 0;
	for (int i = 1 ; i <= n ; ++ i)
	  if (B[i].a > 0)
	    Ans += B[i].a + B[i].c, Flag = true;
	  else
	    if (Min(B[i].b - 1, B[i].c) >= 0)
	      Ans += Min(B[i].b - 1, B[i].c);
	if (!Flag)
	  printf("\n0");
	else
	  printf("\n%lld", Ans);
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 79ms
memory: 7828kb

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:

60073965049724 60073472376204 60073472376204 60073481727701 60073472376204 60073788737330 60073528128564 60073472376204 60073844358663 60073784179153 60073472376204 60073472376204 60073948665985 60073472376204 60073472376204 60073667185445 60073550333929 60073472376204 60073631548329 60073472376204 ...

result:

wrong answer 2nd lines differ - expected: '90874342016986', found: '76310068900191'