QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#155774 | #7120. Soccer | bulijiojiodibuliduo# | 0 | 1480ms | 51708kb | C++17 | 3.2kb | 2023-09-02 04:39:09 | 2024-04-28 06:47:54 |
Judging History
answer
#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head
int bf(int N, std::vector<std::vector<int>> F) {
vector<PII> rg;
int cs=0;
rep(i,0,N) rep(j,0,N) cs+=F[i][j];
if (cs==0) return N*N;
if (cs==1) {
int x=0,y=0;
rep(i,0,N) rep(j,0,N) if (F[i][j]) x=i,y=j;
return N*N-min(x+1,N-x)*min(y+1,N-y);
}
rep(i,0,N) {
int pl=N+1,pr=-1;
rep(j,0,N) {
if (F[i][j]==0) pl=min(pl,j),pr=max(pr,j);
}
if (pl<=pr) {
rg.pb(mp(pl,pr));
rep(j,pl,pr+1) if (F[i][j]==1) { return 0; }
}
}
for (auto q1:rg) for (auto q2:rg) {
auto p1=q1,p2=q2;
if (p1>p2) swap(p1,p2);
if (p1.fi<p2.fi&&p1.se<p2.se) return 0;
}
rg.clear();
rep(j,0,N) {
int pl=N+1,pr=-1;
rep(i,0,N) {
if (F[i][j]==0) pl=min(pl,i),pr=max(pr,i);
}
if (pl<=pr) {
rg.pb(mp(pl,pr));
rep(i,pl,pr+1) if (F[i][j]==1) { return 0; }
}
}
for (auto q1:rg) for (auto q2:rg) {
auto p1=q1,p2=q2;
if (p1.fi<p2.fi&&p1.se<p2.se) return 0;
}
int r=0;
rep(i,0,N) rep(j,0,N) {
if (F[i][j]==0) ++r;
}
return r;
}
const int N=2010;
int stk[N],top,a[N],l[N],r[N],T,ans;
vector<array<int,3>> seg;
map<PII,int> dp,pd;
void dfs(int u,int L,int R) {
if (l[u]) dfs(l[u],L,u-1);
if (r[u]) dfs(r[u],u+1,R);
if (a[u]>T) {
int v=0;
if (pd.count(mp(L,R))) v=pd[mp(L,R)];
v=max(v,(R-L+1)*(a[u]-T));
if (dp.count(mp(L,u-1))) v=max(v,dp[mp(L,u-1)]+(R-L+1-((u-1)-L+1))*(a[u]-T));
if (dp.count(mp(u+1,R))) v=max(v,dp[mp(L,u-1)]+(R-L+1-(R-(u+1)+1))*(a[u]-T));
ans=max(ans,v);
dp[mp(L,R)]=v;
//seg.pb({L-1,R-1,a[u]});
}
}
void build(VI v,int th) {
int top=0;
T=th;
int n=SZ(v);
rep(i,1,n+1) a[i]=v[i-1];
rep(i,1,n+1) l[i]=r[i]=0;
rep(i,1,n+1) {
int k=top;
while (k>0&&a[stk[k-1]]>a[i]) --k;
if (k) r[stk[k-1]]=i;
if (k<top) l[i]=stk[k];
stk[k++]=i;
top=k;
}
dfs(stk[0],1,n);
// rt is stk[0]
}
int biggest_stadium(int n, std::vector<std::vector<int>> F)
{
//if (n>500) return bf(n,F);
vector<vector<int>> nxt(n+1,VI(n));
rep(i,0,n) {
nxt[n][i]=n;
per(L,0,n) {
if (F[i][L]) nxt[L][i]=L;
else nxt[L][i]=nxt[L+1][i];
}
}
rep(L,0,n) {
pd=dp; dp.clear();
build(nxt[L],L);
}
return ans;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 6
Accepted
time: 0ms
memory: 3848kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 1 0
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 1
result:
ok ok
Test #2:
score: 6
Accepted
time: 0ms
memory: 4088kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 0 0 1 0 0 0 0
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 5
result:
ok ok
Test #3:
score: 1.5
Acceptable Answer
time: 2ms
memory: 4004kb
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: 70ms
memory: 7268kb
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 301301
result:
points 0.250 partial
Test #5:
score: 1.5
Acceptable Answer
time: 1480ms
memory: 51708kb
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:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 4821240
result:
points 0.250 partial
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 3780kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 9 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 72
result:
wrong answer wrong
Subtask #2:
score: 0
Wrong Answer
Test #10:
score: 8
Accepted
time: 0ms
memory: 3896kb
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: 3832kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 0 0 1 1 0 0 1
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 5
result:
ok ok
Test #12:
score: 2
Acceptable Answer
time: 0ms
memory: 4084kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 1 0 0 0 1 1 0
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 4
result:
points 0.250 partial
Test #13:
score: 8
Accepted
time: 0ms
memory: 4084kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 1 0 0 1 0 1 0 0 1
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 4
result:
ok ok
Test #14:
score: 2
Acceptable Answer
time: 0ms
memory: 4120kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 1 0 0 0 1 0 0
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 4
result:
points 0.250 partial
Test #15:
score: 0
Wrong Answer
time: 0ms
memory: 3824kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 1 0 0 1 0 0 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%