Submission #629099

# Submission time Handle Problem Language Result Execution time Memory
629099 2022-08-14T07:30:12 Z kwongweng Catfish Farm (IOI22_fish) C++17
9 / 100
56 ms 6480 KB
#include "fish.h"

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

typedef long long ll;
typedef vector<int> vi;
#define FOR(i,a,b) for(int i = a; i < b; i++)

ll max_weights(int N, int M, vi X, vi Y, vi W) {
  vector<ll> A(N);
  FOR(i,0,M){
    A[X[i]] = W[i];
  }
  ll dp[N][2]; memset(dp,0,sizeof(dp));
  if (N>1){
    dp[1][0] = A[1];
    dp[1][1] = A[0];
  }
  FOR(i,2,N){
    dp[i][0] = dp[i-1][1] + A[i];
    dp[i][1] = max(max(dp[i-1][1], dp[i-1][0]), dp[i-2][0] + A[i-1]);
  }
  FOR(i,0,M){
    if (Y[i] > 0){
      ll ans = 0; FOR(j,0,M) ans += W[i];
      return ans;
    } 
  }
  return max(dp[N-1][0], dp[N-1][1]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 4188 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '4445827344520'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 56 ms 6480 KB 1st lines differ - on the 1st token, expected: '40604614618209', found: '47463194382864'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 21 ms 3668 KB Output is correct
4 Correct 12 ms 3440 KB Output is correct
5 Correct 51 ms 4936 KB Output is correct
6 Correct 27 ms 4912 KB Output is correct
7 Correct 34 ms 4920 KB Output is correct
8 Correct 33 ms 4932 KB Output is correct
# 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 Incorrect 1 ms 256 KB 1st lines differ - on the 1st token, expected: '4044', found: '8088'
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 Incorrect 1 ms 256 KB 1st lines differ - on the 1st token, expected: '4044', found: '8088'
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 Incorrect 1 ms 256 KB 1st lines differ - on the 1st token, expected: '4044', found: '8088'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 21 ms 3668 KB Output is correct
4 Correct 12 ms 3440 KB Output is correct
5 Correct 51 ms 4936 KB Output is correct
6 Correct 27 ms 4912 KB Output is correct
7 Correct 34 ms 4920 KB Output is correct
8 Correct 33 ms 4932 KB Output is correct
9 Correct 31 ms 4936 KB Output is correct
10 Incorrect 34 ms 4996 KB 1st lines differ - on the 1st token, expected: '36454348383152', found: '8356119200000'
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 4188 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '4445827344520'
2 Halted 0 ms 0 KB -