Submission #652456

# Submission time Handle Problem Language Result Execution time Memory
652456 2022-10-22T17:04:12 Z Blagoj Catfish Farm (IOI22_fish) C++17
9 / 100
114 ms 7264 KB
#include "fish.h"
#include <bits/stdc++.h>
 
using namespace std;
 
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) {
  
  bool Even = true, Less = true;
  long long sum1 = 0, sum2 = 0;
  for (auto x : X)
  {
    if (x % 2 != 0)
    {
      Even = false;
    }
    if (x > 1)
    {
      Less = false;
    }
  } 
  if (Even)
  {
    long long sum = 0;
    for (auto x : W)
    {
      sum += x;
    }
    return sum;
  }
  if (Less)
  {
    long long m[N + 3][3];
    memset(m, 0, sizeof(m));
    for (int i = 0; i < M; i++)
    {
      m[Y[i]][X[i]] = W[i];
    }
    for (int i = 1; i < N; i++)
    {
      m[i][0] += m[i - 1][0];
      m[i][1] += m[i - 1][1];
    }
    long long ans = max(m[N - 1][0], m[N - 1][1]);
    if (N == 2)
    {
      return ans;
    }
    for (int i = 0; i < N; i++)
    {
      ans = max(ans, m[i][0] + m[N - 1][1] - m[i][1]);
    }
    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:9:13: warning: unused variable 'sum1' [-Wunused-variable]
    9 |   long long sum1 = 0, sum2 = 0;
      |             ^~~~
fish.cpp:9:23: warning: unused variable 'sum2' [-Wunused-variable]
    9 |   long long sum1 = 0, sum2 = 0;
      |                       ^~~~
fish.cpp:54:1: warning: control reaches end of non-void function [-Wreturn-type]
   54 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 29 ms 2140 KB Output is correct
2 Correct 31 ms 2620 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 114 ms 7264 KB Output is correct
6 Correct 101 ms 7264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 60 ms 6176 KB Output is correct
3 Correct 64 ms 7260 KB Output is correct
4 Correct 29 ms 2132 KB Output is correct
5 Correct 34 ms 2616 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 Correct 37 ms 4300 KB Output is correct
13 Correct 30 ms 4940 KB Output is correct
14 Correct 30 ms 4208 KB Output is correct
15 Correct 33 ms 4704 KB Output is correct
16 Correct 26 ms 4320 KB Output is correct
17 Correct 33 ms 4688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Incorrect 18 ms 3640 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '8940704678752'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 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 1 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 1 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 Correct 2 ms 2644 KB Output is correct
3 Incorrect 18 ms 3640 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '8940704678752'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 29 ms 2140 KB Output is correct
2 Correct 31 ms 2620 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 114 ms 7264 KB Output is correct
6 Correct 101 ms 7264 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 60 ms 6176 KB Output is correct
9 Correct 64 ms 7260 KB Output is correct
10 Correct 29 ms 2132 KB Output is correct
11 Correct 34 ms 2616 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 Correct 37 ms 4300 KB Output is correct
19 Correct 30 ms 4940 KB Output is correct
20 Correct 30 ms 4208 KB Output is correct
21 Correct 33 ms 4704 KB Output is correct
22 Correct 26 ms 4320 KB Output is correct
23 Correct 33 ms 4688 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 2 ms 2644 KB Output is correct
26 Incorrect 18 ms 3640 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '8940704678752'
27 Halted 0 ms 0 KB -