Submission #739753

# Submission time Handle Problem Language Result Execution time Memory
739753 2023-05-11T08:22:35 Z Nonoze Catfish Farm (IOI22_fish) C++17
3 / 100
89 ms 14656 KB
#include "fish.h"

#include <bits/stdc++.h>
using namespace std;



long long max_weights(int n, int m, vector<int> X, vector<int> Y, vector<int> W) {
	#define int long long
	bool tacha=true, tachb=true, tachc=true;
	for (int i = 0; i < m; ++i)
	{
		if (X[i]%2) tacha=false;
		if (X[i]>1) tachb=false;
		if (Y[i]) tachc=false;
	}
	if (tacha)
	{
		int ans=0;
		for (int i = 0; i < m; ++i) ans+=W[i];
		return ans;
	}
	if (tachb)
	{
		int sommegauche=0, sommeact=0;
		vector<pair<pair<int, int>, int>> poissons;
		for (int i = 0; i < m; ++i)
		{
			if (X[i]==0) sommegauche+=W[i];
			else sommeact+=W[i];
			poissons.push_back({{Y[i], X[i]}, W[i]});
		}
		if(n<=2) return max(sommegauche, sommeact);
		sort(poissons.begin(), poissons.end());
		int ans=0;
		for (int i = 0; i < m; ++i)
		{
			int x=poissons[i].first.second, y=poissons[i].first.first, w=poissons[i].second;
			if (x==0)
			{
				sommeact+=w;
				if (i<m-1 && poissons[i+1].first.second==1 && poissons[i+1].first.first==y)
				{
					sommeact-=poissons[i+1].second;
					i++;
				}
			}
			else {
				sommeact-=w;
			}
			ans=max(ans, sommeact);
		}
		return ans;
	}
	#undef int
	return 0;
}

Compilation message

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:10:31: warning: variable 'tachc' set but not used [-Wunused-but-set-variable]
   10 |  bool tacha=true, tachb=true, tachc=true;
      |                               ^~~~~
# Verdict Execution time Memory Grader output
1 Correct 21 ms 2124 KB Output is correct
2 Correct 28 ms 2636 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 89 ms 7428 KB Output is correct
6 Correct 86 ms 7320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 65 ms 10512 KB Output is correct
3 Correct 80 ms 14656 KB Output is correct
4 Correct 24 ms 3528 KB Output is correct
5 Correct 29 ms 4284 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 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 Incorrect 33 ms 6732 KB 1st lines differ - on the 1st token, expected: '40374264367003', found: '40373752857962'
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 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: '0'
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: '0'
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: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 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 21 ms 2124 KB Output is correct
2 Correct 28 ms 2636 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 89 ms 7428 KB Output is correct
6 Correct 86 ms 7320 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 65 ms 10512 KB Output is correct
9 Correct 80 ms 14656 KB Output is correct
10 Correct 24 ms 3528 KB Output is correct
11 Correct 29 ms 4284 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 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 Incorrect 33 ms 6732 KB 1st lines differ - on the 1st token, expected: '40374264367003', found: '40373752857962'
19 Halted 0 ms 0 KB -