QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#882568#9879. ReTravelMnZnWA 45ms7656kbC++14765b2025-02-05 09:26:272025-02-05 09:26:36

Judging History

This is the latest submission verdict.

  • [2025-02-05 09:26:36]
  • Judged
  • Verdict: WA
  • Time: 45ms
  • Memory: 7656kb
  • [2025-02-05 09:26:27]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i,l,r) for(int i = l; i <= r; i ++)
#define rrp(i,l,r) for(int i = l; i >= r; i --)
const int N = 505;
int n, a[N], b[N], x[N][N], y[N][N];
LL f[N][N];
signed main() {
  cin.tie(0)->ios::sync_with_stdio(0);
  cin >> n, ++ n;
  rep (i, 2, n) cin >> a[i] >> b[i];
  rep (l, 1, n) {
    x[l][l] = a[l], y[l][l] = b[l];
    rep (r, l + 1, n) {
      x[l][r] = min(x[l][r-1], a[r]);
      y[l][r] = min(y[l][r-1], b[r]);
    }
  }
  rrp (l, n, 1) rep(r, l + 1, n) {
    f[l][r] = 1e18;
    rep (i, l, r - 1) f[l][r] = min(f[l][r], f[l][i] + f[i+1][r] +
    x[l][i] + x[i+1][r] + y[l][i] + y[i+1][r] - 2 * (x[l][r] + y[l][r]));
  }
  cout << f[1][n];
  return 0;
}

詳細信息

Test #1:

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

input:

2
3 3
1 2

output:

6

result:

ok "6"

Test #2:

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

input:

3
2 2
3 3
1 3

output:

7

result:

ok "7"

Test #3:

score: -100
Wrong Answer
time: 45ms
memory: 7656kb

input:

500
906691059 413653999
813847339 955892128
451585301 43469773
278009742 548977048
521760889 434794718
985946604 841597326
891047768 325679554
511742081 384452587
626401695 957413342
975078788 234551094
541903389 149544006
302621084 150050891
811538590 101823753
663968655 858351976
268979133 9768326...

output:

229026219910

result:

wrong answer 1st words differ - expected: '202616034783', found: '229026219910'