Submission #627355

# Submission time Handle Problem Language Result Execution time Memory
627355 2022-08-12T13:39:14 Z c28dnv9q3 Catfish Farm (IOI22_fish) C++17
6 / 100
105 ms 8792 KB
#include "fish.h"
#include <vector>

using namespace std;
using ll = long long;

ll max_weights(
  int N, int M, vector<int> X, vector<int> Y, vector<int> W
) {
  vector<ll> pref0(N+1), pref1(N+1);
  for (int i = 0; i < M; i++) {
    if (X[i] == 0)
      pref0[Y[i] + 1] += W[i];
    else
      pref1[Y[i] + 1] += W[i];
  }
  for (int i = 1; i <= N; i++) {
    pref0[i] += pref0[i-1];
    pref1[i] += pref1[i-1];
  }
  ll s1 = 0, s2 = 0, s3 = 0;
  for (int i = 0; i <= N; i++) {
    s1 = max(s1, pref1[i]);
    s2 = max(s2, pref0[i]);
    s3 = max(s3, pref1[N] - pref1[i] + pref0[i]);
  }

  if (N == 2)
    return max(s1, s2);
  
  return max(s1, max(s2, s3));
}
# Verdict Execution time Memory Grader output
1 Correct 22 ms 3544 KB Output is correct
2 Correct 34 ms 4152 KB Output is correct
3 Correct 2 ms 1748 KB Output is correct
4 Correct 1 ms 1748 KB Output is correct
5 Correct 84 ms 8788 KB Output is correct
6 Incorrect 105 ms 8792 KB 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000'
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 44 ms 5388 KB Output is correct
3 Correct 54 ms 6744 KB Output is correct
4 Correct 22 ms 3796 KB Output is correct
5 Correct 29 ms 4424 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 1748 KB Output is correct
11 Correct 2 ms 1876 KB Output is correct
12 Correct 23 ms 3736 KB Output is correct
13 Correct 27 ms 4424 KB Output is correct
14 Correct 23 ms 3760 KB Output is correct
15 Correct 26 ms 4212 KB Output is correct
16 Correct 23 ms 3852 KB Output is correct
17 Correct 27 ms 4100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1748 KB Output is correct
2 Correct 2 ms 1748 KB Output is correct
3 Incorrect 15 ms 2900 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1748 KB Output is correct
2 Correct 2 ms 1748 KB Output is correct
3 Incorrect 15 ms 2900 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 3544 KB Output is correct
2 Correct 34 ms 4152 KB Output is correct
3 Correct 2 ms 1748 KB Output is correct
4 Correct 1 ms 1748 KB Output is correct
5 Correct 84 ms 8788 KB Output is correct
6 Incorrect 105 ms 8792 KB 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000'
7 Halted 0 ms 0 KB -