Submission #871715

# Submission time Handle Problem Language Result Execution time Memory
871715 2023-11-11T11:14:18 Z Nonoze Catfish Farm (IOI22_fish) C++17
9 / 100
69 ms 13908 KB
#include "fish.h"
//#include "grader.cpp"

#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)
	{
		vector<vector<int>> farm(2, vector<int> (n, 0));
		for (int i=0; i<m; i++) {
			farm[x[i]][y[i]]=w[i];
		}
		vector<int> suml, sumr;
		suml.push_back(farm[0][0]);
		sumr.push_back(farm[1][0]);
		for (int i=1; i<n; i++) {
			suml.push_back(suml.back()+farm[0][i]);
			sumr.push_back(sumr.back()+farm[1][i]);
		}
		if (n==2) return max(suml.back(), sumr.back());
		int ans=sumr.back();
		for (int i=0; i<n; i++) {
			ans=max(ans, suml[i]+sumr.back()-sumr[i]);
		}
		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:11:31: warning: variable 'tachc' set but not used [-Wunused-but-set-variable]
   11 |  bool tacha=true, tachb=true, tachc=true;
      |                               ^~~~~
# Verdict Execution time Memory Grader output
1 Correct 17 ms 3544 KB Output is correct
2 Correct 27 ms 4420 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 440 KB Output is correct
5 Correct 68 ms 13788 KB Output is correct
6 Correct 69 ms 13908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 38 ms 10208 KB Output is correct
3 Correct 53 ms 13124 KB Output is correct
4 Correct 18 ms 3676 KB Output is correct
5 Correct 28 ms 4396 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 432 KB Output is correct
10 Correct 0 ms 440 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 19 ms 7476 KB Output is correct
13 Correct 24 ms 8860 KB Output is correct
14 Correct 21 ms 7460 KB Output is correct
15 Correct 22 ms 8512 KB Output is correct
16 Correct 20 ms 7312 KB Output is correct
17 Correct 22 ms 8524 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 348 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 1 ms 504 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 1 ms 504 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 1 ms 504 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 348 KB Output is correct
2 Incorrect 1 ms 348 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 17 ms 3544 KB Output is correct
2 Correct 27 ms 4420 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 440 KB Output is correct
5 Correct 68 ms 13788 KB Output is correct
6 Correct 69 ms 13908 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 38 ms 10208 KB Output is correct
9 Correct 53 ms 13124 KB Output is correct
10 Correct 18 ms 3676 KB Output is correct
11 Correct 28 ms 4396 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 432 KB Output is correct
16 Correct 0 ms 440 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 19 ms 7476 KB Output is correct
19 Correct 24 ms 8860 KB Output is correct
20 Correct 21 ms 7460 KB Output is correct
21 Correct 22 ms 8512 KB Output is correct
22 Correct 20 ms 7312 KB Output is correct
23 Correct 22 ms 8524 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
26 Halted 0 ms 0 KB -