Submission #682841

# Submission time Handle Problem Language Result Execution time Memory
682841 2023-01-17T06:00:02 Z irmuun Catfish Farm (IOI22_fish) C++17
0 / 100
53 ms 6156 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<n;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[x[i]+1][y[i]]=w[i];
		}
		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:42:1: warning: control reaches end of non-void function [-Wreturn-type]
   42 | }
      | ^
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 3516 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '44863775616942'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 296 KB Output is correct
2 Incorrect 53 ms 6156 KB 1st lines differ - on the 1st token, expected: '40604614618209', found: '40516816667132'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 300 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 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 1 ms 300 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 1 ms 300 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 Runtime error 1 ms 300 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 3516 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '44863775616942'
2 Halted 0 ms 0 KB -