Submission #682858

# Submission time Handle Problem Language Result Execution time Memory
682858 2023-01-17T06:13:42 Z irmuun Catfish Farm (IOI22_fish) C++17
9 / 100
101 ms 7280 KB
#include<bits/stdc++.h>
#include "fish.h"
using namespace std;
#define ll long long
long long max_weights(int n,int m,vector<int>x,vector<int>y,vector<int>w){
	int count=0,X=-1,Y=-1;
	for(int i=0;i<m;i++){
		if(x[i]%2==0){
			count++;
		}
		X=max(X,x[i]);
		Y=max(Y,y[i]);
	}
	if(count==m){//subtask1
		ll ans=0;
		for(int i=0;i<m;i++){
			ans+=w[i];
		}
		return ans;
	}
	if(X<=1){//subtask2
		ll res=0;
		int dp[n+5][2];
		for(int i=0;i<=n;i++){
			dp[i][0]=0;
			dp[i][1]=0;
		}
		ll ans;
		for(int i=0;i<m;i++){
			if(x[i]==1){
				res+=w[i];
			}
			dp[y[i]+1][x[i]]=w[i];
		}
		if(n==2){
			return max(dp[1][0]+dp[2][0],dp[1][1]+dp[2][1]);
		}
		ans=res;
		for(int i=1;i<=n;i++){
			res+=dp[i][0]-dp[i][1];
			ans=max(ans,res);
		}
		return ans;
	}
}

Compilation message

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:45:1: warning: control reaches end of non-void function [-Wreturn-type]
   45 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 20 ms 2132 KB Output is correct
2 Correct 26 ms 2636 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 101 ms 7268 KB Output is correct
6 Correct 97 ms 7280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 44 ms 4768 KB Output is correct
3 Correct 56 ms 5732 KB Output is correct
4 Correct 29 ms 2160 KB Output is correct
5 Correct 31 ms 2620 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 300 KB Output is correct
8 Correct 0 ms 300 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 23 ms 4088 KB Output is correct
13 Correct 28 ms 4668 KB Output is correct
14 Correct 23 ms 4172 KB Output is correct
15 Correct 27 ms 4412 KB Output is correct
16 Correct 25 ms 4180 KB Output is correct
17 Correct 26 ms 4396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 980 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 980 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 2132 KB Output is correct
2 Correct 26 ms 2636 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 101 ms 7268 KB Output is correct
6 Correct 97 ms 7280 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 44 ms 4768 KB Output is correct
9 Correct 56 ms 5732 KB Output is correct
10 Correct 29 ms 2160 KB Output is correct
11 Correct 31 ms 2620 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 300 KB Output is correct
14 Correct 0 ms 300 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 23 ms 4088 KB Output is correct
19 Correct 28 ms 4668 KB Output is correct
20 Correct 23 ms 4172 KB Output is correct
21 Correct 27 ms 4412 KB Output is correct
22 Correct 25 ms 4180 KB Output is correct
23 Correct 26 ms 4396 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Incorrect 1 ms 980 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
26 Halted 0 ms 0 KB -