Submission #1031822

# Submission time Handle Problem Language Result Execution time Memory
1031822 2024-07-23T07:41:00 Z Malix Catfish Farm (IOI22_fish) C++17
12 / 100
55 ms 20064 KB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pi;
typedef vector<pi> pii;
typedef tuple<int,int,int> tii;
typedef vector<ll> li;
typedef vector<li> lii;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define LSOne(s) ((s)&(-s))

ll INF=1e16+10;
int inf=1e9+10;
ll M=1e9+7;

long long max_weights(int n, int m, std::vector<int> X, std::vector<int> Y,
                      std::vector<int> W) {
  vector<vector<ll>> dp(n,vector<ll>(2,0));
  vector<ll> arr(n,0);
  REP(i,0,m)arr[X[i]]+=(ll)W[i];
  dp[0][0]=arr[1];
  dp[1][0]=arr[0];dp[1][1]=arr[1];
  if(n>2)dp[1][0]+=arr[2];
  REP(i,2,n){
    dp[i][1]=max(dp[i-1][0],dp[i-1][1]);
    dp[i][0]=max(dp[i-1][0]-arr[i],max(dp[i-2][1]+arr[i-1],dp[i-2][0]));
    if(i!=n-1)dp[i][0]+=arr[i+1];
  }
  return max(dp[n-1][0],dp[n-1][1]);
}
# Verdict Execution time Memory Grader output
1 Correct 16 ms 9216 KB Output is correct
2 Correct 24 ms 10692 KB Output is correct
3 Correct 7 ms 6492 KB Output is correct
4 Correct 4 ms 6492 KB Output is correct
5 Correct 55 ms 19620 KB Output is correct
6 Correct 51 ms 20064 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 6492 KB Output is correct
2 Correct 4 ms 6496 KB Output is correct
3 Correct 13 ms 8284 KB Output is correct
4 Correct 11 ms 8160 KB Output is correct
5 Correct 22 ms 10556 KB Output is correct
6 Correct 16 ms 9916 KB Output is correct
7 Correct 33 ms 10584 KB Output is correct
8 Correct 20 ms 10584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 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 348 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 348 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 4 ms 6492 KB Output is correct
2 Correct 4 ms 6496 KB Output is correct
3 Correct 13 ms 8284 KB Output is correct
4 Correct 11 ms 8160 KB Output is correct
5 Correct 22 ms 10556 KB Output is correct
6 Correct 16 ms 9916 KB Output is correct
7 Correct 33 ms 10584 KB Output is correct
8 Correct 20 ms 10584 KB Output is correct
9 Incorrect 17 ms 10336 KB 1st lines differ - on the 1st token, expected: '99999', found: '66666'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 9216 KB Output is correct
2 Correct 24 ms 10692 KB Output is correct
3 Correct 7 ms 6492 KB Output is correct
4 Correct 4 ms 6492 KB Output is correct
5 Correct 55 ms 19620 KB Output is correct
6 Correct 51 ms 20064 KB Output is correct
7 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
8 Halted 0 ms 0 KB -