QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#317383 | #7120. Soccer | Random_Code# | 0 | 923ms | 15464kb | C++17 | 2.7kb | 2024-01-28 22:02:49 | 2024-04-28 08:34:16 |
Judging History
answer
//ANMHLIJKTJIY!
#pragma GCC optimize(2)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline","fast-math","unroll-loops","no-stack-protector")
#pragma GCC diagnostic error "-fwhole-program"
#pragma GCC diagnostic error "-fcse-skip-blocks"
#pragma GCC diagnostic error "-funsafe-loop-optimizations"
#include "soccer.h"
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 998244353
#define F first
#define S second
#define ll int
#define N 510
using namespace std;
ll n,a[N][N],f[2][N][N][2][2],mx[N][N];
int biggest_stadium(int _n,vector<vector<int> > grid)
{
ll i,j,k,l,ans=0;
n=_n;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
a[i][j]=grid[i][j];
}
}
memset(f[0],-63,sizeof(f[0]));
for(i=0;i<n;i++)
{
ll u=i&1,v=u^1;
for(j=0;j<n;j++)
{
for(k=j;k<n;k++)
{
f[v][j][k][0][0]=0;
f[v][j][k][0][1]=0;
f[v][j][k][1][0]=0;
f[v][j][k][1][1]=0;
}
}
for(j=0;j<n;j++)
{
f[v][j][j][0][0]=f[u][j][j][0][0];
}
for(j=2;j<=n;j++)
{
for(k=0;k+j-1<n;k++)
{
f[v][k][k+j-1][0][0]=max(f[u][k][k+j-1][0][0],max(f[v][k][k+j-2][0][0],f[v][k+1][k+j-1][0][0]));
}
}
for(j=0;j<n;j++)
{
mx[j][n]=0;
for(k=n-1;k>=j;k--)
{
mx[j][k]=max(mx[j][k+1],max(f[u][j][k][0][0],f[u][j][k][0][1]));
}
}
for(j=0;j<n;j++)
{
ll cur=0;
for(k=j;k>=0&&(!a[i][k]);k--)
{
cur=max(cur,mx[k][j]);
f[v][k][j][0][1]=cur;
}
}
for(j=0;j<n;j++)
{
mx[j][0]=f[u][0][j][0][0];
for(k=1;k<=j;k++)
{
mx[j][k]=max(mx[j][k-1],max(f[u][k][j][0][0],f[u][k][j][1][0]));
}
}
for(j=0;j<n;j++)
{
ll cur=0;
for(k=j;k<n&&(!a[i][k]);k++)
{
cur=max(cur,mx[k][j]);
f[v][j][k][1][0]=cur;
}
}
f[v][0][n-1][1][1]=max(max(f[u][0][n-1][0][0],f[u][0][n-1][0][1]),max(f[u][0][n-1][1][0],f[u][0][n-1][1][1]));
for(j=n-1;j>=1;j--)
{
for(k=0;k+j-1<n;k++)
{
ll val=max(max(f[u][k][k+j-1][0][0],f[u][k][k+j-1][0][1]),max(f[u][k][k+j-1][1][0],f[u][k][k+j-1][1][1]));
f[v][k][k+j-1][1][1]=max(val,max((k+j==n?0:f[v][k][k+j][1][1]),(k==0?0:f[v][k-1][k+j-1][1][1])));
}
}
for(j=0;j<n;j++)
{
for(k=j;k<n;k++)
{
f[v][j][k][0][0]+=k-j+1;
f[v][j][k][0][1]+=k-j+1;
f[v][j][k][1][0]+=k-j+1;
f[v][j][k][1][1]+=k-j+1;
}
}
for(j=k=0;j<n;j++)
{
while(k<n&&(!a[i][k]))
{
k++;
}
for(l=k;l<n;l++)
{
f[v][j][l][0][0]=f[v][j][l][1][1]=-INF;
}
}
for(j=0;j<n;j++)
{
for(k=j;k<n;k++)
{
ans=max(ans,f[v][j][k][0][0]);
ans=max(ans,f[v][j][k][0][1]);
ans=max(ans,f[v][j][k][1][0]);
ans=max(ans,f[v][j][k][1][1]);
}
}
}
return ans;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Runtime Error
Test #1:
score: 6
Accepted
time: 2ms
memory: 10036kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 1 0
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 1
result:
ok ok
Test #2:
score: 1.5
Acceptable Answer
time: 0ms
memory: 9944kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 0 0 1 0 0 0 0
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 6
result:
points 0.250 partial
Test #3:
score: 1.5
Acceptable Answer
time: 7ms
memory: 10952kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 9847
result:
points 0.250 partial
Test #4:
score: 1.5
Acceptable Answer
time: 923ms
memory: 15464kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 236104
result:
points 0.250 partial
Test #5:
score: 0
Runtime Error
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 2000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
result:
Subtask #2:
score: 0
Wrong Answer
Test #10:
score: 8
Accepted
time: 2ms
memory: 9968kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 0 0 1 0 0 1 1
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 5
result:
ok ok
Test #11:
score: 8
Accepted
time: 0ms
memory: 10488kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 0 0 1 1 0 0 1
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 5
result:
ok ok
Test #12:
score: 0
Wrong Answer
time: 2ms
memory: 10684kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 1 0 0 0 1 1 0
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 6
result:
wrong answer wrong
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
0%