QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#312299#5146. SkillsqzhfxWA 33ms4620kbC++231.7kb2024-01-23 19:32:122024-01-23 19:32:13

Judging History

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

  • [2024-01-23 19:32:13]
  • 评测
  • 测评结果:WA
  • 用时:33ms
  • 内存:4620kb
  • [2024-01-23 19:32:12]
  • 提交

answer

#pragma GCC optimize(3, "Ofast", "inline")
#include<bits/stdc++.h>
#define endl '\n'
#define INF 0x3f3f3f3f3f3f3f3f
#define inf 0x3f3f3f3f
#define lowbit(x) ((x)&(-x))
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int N = 1e3 + 7;
const int mod = 998244353;
int f[2][3][210][210];
int a[N][3];
void solve(){
    int n;
    cin >> n;
    for(int i=1;i<=n;i++){
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    }
    memset(f,0,sizeof f);
    int now = 0;
    for(int i=0;i<n;i++){
        for(int x = 0;x < 3; x++) {
            for (int j = 0; j < 210&&j<=i; j++) {
                for (int k = 0; k < 210&&k<=i; k++) {
                    int pj = j ? j + 1 : 0, pk = k ? k + 1 : 0;
                    if(pj<210&&pk<210)f[now][x][j][k] = max(f[now][x][pj][pk],f[now^1][x][j][k] - pj - pk + a[i + 1][x]);
                    if(pk<210)f[now][(x + 1) % 3][pk][1] = max(f[now][(x + 1) % 3][pk][1],f[now ^ 1][x][j][k] - 1 - pk + a[i + 1][(x + 1) % 3]);
                    if(pj<210)f[now][(x + 2) % 3][1][pj] = max(f[now][(x + 2) % 3][1][pj],f[now ^ 1][x][j][k] - 1 - pj + a[i + 1][(x + 2) % 3]);
                }
            }
        }
        now ^= 1;
    }
    int ans = 0;
    for(int x = 0; x < 3; x ++){
        for(int j = 0;j< 210;j ++){
            for(int k = 0;k < 210;k ++){
                ans = max(ans,f[now ^ 1][x][j][k]);
            }
        }
    }
    cout << ans << endl;
}
int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#ifdef qzhfx
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
#endif
    int t;
    t = 1;
    cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 4580kb

input:

2
3
1 1 10
1 10 1
10 1 1
5
1 2 3
6 5 4
7 8 9
12 11 10
13 14 15

output:

26
41

result:

ok 2 number(s): "26 41"

Test #2:

score: -100
Wrong Answer
time: 33ms
memory: 4620kb

input:

1
200
6219 3608 2383
1139 2158 8611
6721 8216 8887
8736 6707 9755
7210 248 167
3849 276 8050
971 5062 1914
8290 1562 6017
8993 7990 3460
6323 6099 757
7652 4740 6117
6560 4206 180
3705 8906 5752
9619 8939 9696
793 6680 1777
384 3606 8772
9258 3906 709
4396 5083 6614
6057 4410 3132
8596 825 7437
6098...

output:

1101197

result:

wrong answer 1st numbers differ - expected: '1505431', found: '1101197'