QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#43874 | #4561. Catfish Farm | Y25t# | 0 | 1ms | 4248kb | C++11 | 1.4kb | 2022-08-11 14:26:41 | 2024-05-26 01:04:02 |
Judging History
answer
#include"fish.h"
#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
#define N 3005
inline void chk(ll &x,ll y){
x=std::max(x,y);
}
std::map<std::pair<int,int>,int> mp;
std::vector<int> V[N];
std::vector<ll> S[N];
inline ll s(int i,int j){
int o=std::upper_bound(V[i].begin(),V[i].end(),j)-V[i].begin()-1;
return o>=0?S[i][o]:0;
}
ll f[N],g[N],F[N],G[N];
ll max_weights(int n,int m,std::vector<int> a,std::vector<int> b,std::vector<int> c){
for(int i=0;i<m;i++)
V[a[i]+1].emplace_back(b[i]),mp[{a[i]+1,b[i]+1}]=c[i];
for(int i=1;i<=n;i++){
V[i].emplace_back(n),std::sort(V[i].begin(),V[i].end());
S[i].resize(V[i].size());
for(int j=0;j<(int)V[i].size()-1;j++)
S[i][j+1]=mp[{i,V[i][j]+1}];
for(int j=1;j<(int)V[i].size();j++)
S[i][j]+=S[i][j-1];
}
V[0].emplace_back(0),S[0].emplace_back(0);
memset(f,~0x3f,sizeof(f)),memset(g,~0x3f,sizeof(g));
f[0]=g[0]=0;
for(int i=1;i<=n;i++){
for(auto x:V[i-1]){
chk(F[*std::lower_bound(V[i].begin(),V[i].end(),x)],g[x]+s(i,x));
for(auto y:V[i]){
if(x>=y){
chk(F[y],f[x]),chk(G[y],f[x]);
chk(G[y],g[x]+s(i,x)-s(i,y));
}
else{
chk(F[y],f[x]+s(i-1,y)-s(i-1,x)),chk(G[y],f[x]+s(i-1,y)-s(i-1,x));
chk(F[y],g[x]),chk(G[y],g[x]);
}
}
}
for(auto y:V[i])
f[y]=F[y],g[y]=G[y],F[y]=G[y]=~inf;
}
ll res=0;
for(auto i:V[n])
chk(res,f[i]),chk(res,g[i]);
return res;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Runtime Error
Test #1:
score: 0
Runtime Error
input:
f785163bfcb92ce6ac387bba5d2f29a0e0f37f19 90000 80699 0 10792 55091480 0 36762 389250726 0 79267 706445371 0 76952 290301137 0 13444 69711795 0 68980 66221400 0 1695 703252611 0 36628 632571604 0 87676 264578012 0 79496 397448339 0 57929 447544332 0 35453 355374818 0 62449 686423696 0 45614 667165709...
output:
Unauthorized output
result:
Subtask #2:
score: 0
Wrong Answer
Test #7:
score: 0
Wrong Answer
time: 1ms
memory: 3960kb
input:
f785163bfcb92ce6ac387bba5d2f29a0e0f37f19 3 2 0 0 1 1 1 1
output:
938f2698235a9ff1d1d91e23381b68bec7bed102 OK 1
result:
wrong answer 3rd lines differ - expected: '2', found: '1'
Subtask #3:
score: 0
Runtime Error
Test #20:
score: 0
Runtime Error
input:
f785163bfcb92ce6ac387bba5d2f29a0e0f37f19 100000 1 0 0 10082010
output:
Unauthorized output
result:
Subtask #4:
score: 0
Wrong Answer
Test #28:
score: 0
Wrong Answer
time: 0ms
memory: 4248kb
input:
f785163bfcb92ce6ac387bba5d2f29a0e0f37f19 4 3 2 2 1 0 0 1 1 1 1
output:
938f2698235a9ff1d1d91e23381b68bec7bed102 OK 2
result:
wrong answer 3rd lines differ - expected: '3', found: '2'
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #5:
0%
Subtask #7:
score: 0
Runtime Error
Test #60:
score: 0
Runtime Error
input:
f785163bfcb92ce6ac387bba5d2f29a0e0f37f19 100000 99999 31026 31026 1 42940 42940 1 69303 69303 1 90350 90350 1 77507 77507 1 87126 87126 1 17988 17988 1 5146 5146 1 63023 63023 1 27776 27776 1 6136 6136 1 82557 82557 1 24904 24904 1 21667 21667 1 67271 67271 1 80294 80294 1 81145 81145 1 47144 47144 ...
output:
Unauthorized output
result:
Subtask #8:
score: 0
Skipped
Dependency #1:
0%