QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#43887#4561. Catfish FarmY25t#0 135ms32452kbC++111.8kb2022-08-11 14:41:202024-05-26 01:04:10

Judging History

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

  • [2024-05-26 01:04:10]
  • 评测
  • 测评结果:0
  • 用时:135ms
  • 内存:32452kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-08-11 14:41:20]
  • 提交

answer

#include"fish.h"
#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
#define N 100005

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::lower_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]=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));
		ll A=~inf,B=~inf;
		for(int j=(int)V[i-1].size()-1,k=(int)V[i].size()-1;j>=0||k>=0;){
			if(j>=0&&(k<0||V[i-1][j]>V[i][k])){
				int x=V[i-1][j--];
				chk(A,f[x]),chk(B,g[x]+s(i,x));
			}
			else{
				int y=V[i][k--];
				chk(F[y],A),chk(G[y],A),chk(G[y],B-s(i,y));
			}
		}
		A=B=~inf;
		for(int j=0,k=0;j<(int)V[i-1].size()||k<(int)V[i].size();){
			if(j<(int)V[i-1].size()&&(k>=(int)V[i].size()||V[i-1][j]<V[i][k])){
				int x=V[i-1][j++];
				chk(A,f[x]-s(i-1,x)),chk(B,g[x]);
			}
			else{
				int y=V[i][k++];
				chk(F[y],A+s(i-1,y)),chk(G[y],A+s(i-1,y)),chk(F[y],B),chk(G[y],B);
			}
		}
		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;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 62ms
memory: 24400kb

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:

938f2698235a9ff1d1d91e23381b68bec7bed102
OK
0

result:

wrong answer 3rd lines differ - expected: '40313272768926', found: '0'

Subtask #2:

score: 0
Wrong Answer

Test #7:

score: 6
Accepted
time: 2ms
memory: 10316kb

input:

f785163bfcb92ce6ac387bba5d2f29a0e0f37f19
3 2
0 0 1
1 1 1

output:

938f2698235a9ff1d1d91e23381b68bec7bed102
OK
2

result:

ok 3 lines

Test #8:

score: -6
Wrong Answer
time: 135ms
memory: 32452kb

input:

f785163bfcb92ce6ac387bba5d2f29a0e0f37f19
90000 161862
0 56823 293232472
0 28967 124369573
1 8799 138712011
0 87115 743135614
1 56429 262092699
0 61318 597172732
0 39127 477101342
1 44938 277680401
1 79037 997527330
1 88113 13289754
0 29715 35249311
0 50637 709319782
1 20760 845594381
1 80662 6299890...

output:

938f2698235a9ff1d1d91e23381b68bec7bed102
OK
0

result:

wrong answer 3rd lines differ - expected: '40604614618209', found: '0'

Subtask #3:

score: 0
Wrong Answer

Test #20:

score: 0
Wrong Answer
time: 11ms
memory: 16364kb

input:

f785163bfcb92ce6ac387bba5d2f29a0e0f37f19
100000 1
0 0 10082010

output:

938f2698235a9ff1d1d91e23381b68bec7bed102
OK
0

result:

wrong answer 3rd lines differ - expected: '10082010', found: '0'

Subtask #4:

score: 0
Wrong Answer

Test #28:

score: 14
Accepted
time: 2ms
memory: 10620kb

input:

f785163bfcb92ce6ac387bba5d2f29a0e0f37f19
4 3
2 2 1
0 0 1
1 1 1

output:

938f2698235a9ff1d1d91e23381b68bec7bed102
OK
3

result:

ok 3 lines

Test #29:

score: 0
Accepted
time: 2ms
memory: 10312kb

input:

f785163bfcb92ce6ac387bba5d2f29a0e0f37f19
8 7
5 5 1
4 4 1
6 6 1
3 3 1
0 0 1
2 2 1
1 1 1

output:

938f2698235a9ff1d1d91e23381b68bec7bed102
OK
7

result:

ok 3 lines

Test #30:

score: 0
Accepted
time: 0ms
memory: 10508kb

input:

f785163bfcb92ce6ac387bba5d2f29a0e0f37f19
3 2
0 0 1
1 1 1

output:

938f2698235a9ff1d1d91e23381b68bec7bed102
OK
2

result:

ok 3 lines

Test #31:

score: 0
Accepted
time: 2ms
memory: 10112kb

input:

f785163bfcb92ce6ac387bba5d2f29a0e0f37f19
3 2
2 0 1
1 1 1

output:

938f2698235a9ff1d1d91e23381b68bec7bed102
OK
2

result:

ok 3 lines

Test #32:

score: -14
Wrong Answer
time: 0ms
memory: 11672kb

input:

f785163bfcb92ce6ac387bba5d2f29a0e0f37f19
150 600
79 2 983288470
11 0 322623476
136 0 774411048
24 2 816724362
21 2 719492379
33 3 892309581
47 0 473707335
31 2 781573473
138 2 82986686
75 1 126753954
20 1 54988783
121 1 691958594
20 0 545299878
96 0 637112704
108 1 558914127
74 2 517404335
94 1 7420...

output:

938f2698235a9ff1d1d91e23381b68bec7bed102
OK
216535146944

result:

wrong answer 3rd lines differ - expected: '216624184325', found: '216535146944'

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Wrong Answer

Test #60:

score: 14
Accepted
time: 68ms
memory: 25816kb

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:

938f2698235a9ff1d1d91e23381b68bec7bed102
OK
99999

result:

ok 3 lines

Test #61:

score: -14
Wrong Answer
time: 65ms
memory: 21888kb

input:

f785163bfcb92ce6ac387bba5d2f29a0e0f37f19
50000 100000
43737 0 616909786
28149 1 83561192
31215 0 81425452
11831 1 127789871
33975 1 294422160
44409 1 920754334
44149 1 547214118
23078 0 749134931
39070 1 425147230
39398 1 49764337
49388 0 1922565
13827 0 24394607
45462 0 276157952
30584 0 435992379
...

output:

938f2698235a9ff1d1d91e23381b68bec7bed102
OK
36401987883582

result:

wrong answer 3rd lines differ - expected: '36454348383152', found: '36401987883582'

Subtask #8:

score: 0
Skipped

Dependency #1:

0%