QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#312692 | #5146. Skills | NCl3 | WA | 435ms | 300036kb | C++17 | 2.6kb | 2024-01-24 10:45:18 | 2024-01-24 10:45:18 |
Judging History
answer
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define vi vector<int>
using namespace std;
typedef pair<int, int> pii;
constexpr int N=210;
constexpr int inf = 1e18;
struct A
{
int a;
bool operator<(const A &t) const
{
return a < t.a;
}
};
// priority_queue<pii, vector<pii>, greater<pii>> heap;
// cout << setprecision(n)
void solve()
{
int n;
cin>>n;
// f[n][150][150][150]
vector<array<int,3>> a(n+1);
for(int i=1;i<=n;i++)
for(int j=0;j<3;j++)
cin >> a[i][j];
vector f(3,vector(N,vector(N,vector(N,0ll))));
for(int i=0;i<n;i++){
//0
int nxt=i&1^1,cur=i&1;
cout<<cur<<' '<<nxt<<endl;
for(int j=0;j<N;j++)
for(int k=0;k<N;k++){
int t=0;
int tj = j + (j != 0), tk = k + (k != 0);
if(tj<N&&tk<N){
for (int l = 0; l < N; l++)
t = max(t, f[cur][l][j][k]);
f[nxt][1][tj][tk] = max(f[nxt][1][tj][tk], t+a[i+1][0] - j - k);
}
}
//1
for(int j=0;j<N;j++)
for(int k=0;k<N;k++){
int t=0;
int tj = j + (j != 0), tk = k + (k != 0);
if (tj < N && tk < N)
{
for (int l = 0; l < N; l++)
t = max(t, f[cur][j][l][k]);
f[nxt][tj][1][tk] = max(f[nxt][tj][1][tk], t+a[i+1][1] - j - k);
}
}
//2
for (int j = 0; j < N; j++)
for (int k = 0; k < N; k++)
{
int t = 0;
int tj = j + (j != 0), tk = k + (k != 0);
if (tj < N && tk < N)
{
for (int l = 0; l < N; l++)
t = max(t, f[cur][j][k][l]);
f[nxt][tj][tk][1] = max(f[nxt][tj][tk][1], t+a[i+1][2] - j - k);
}
}
}
int ans=0;
for (int j = 0; j < N; j++)
for (int k = 0; k < N; k++)
ans=max({ans,(f[n&1][1][j][k]),(f[n&1][j][1][k]),(f[n&1][j][k][1])});
// cout<<f[2][0][1][2]<<' '<<f[1][0][1][0]<<' '<<f[1][0][0][1]<<endl;
cout << ans << endl;
}
signed main()
{
// freopen("data3.in", "r", stdin);
// freopen("data3.out", "w", stdout);
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
cin>>t;
while (t--)
{
solve();
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 435ms
memory: 300036kb
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:
0 1 1 0 0 1 26 0 1 1 0 0 1 1 0 0 1 41
result:
wrong answer 1st numbers differ - expected: '26', found: '0'