Submission #1031715

# Submission time Handle Problem Language Result Execution time Memory
1031715 2024-07-23T05:21:43 Z Malix Catfish Farm (IOI22_fish) C++17
3 / 100
65 ms 20320 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,INF));
  vector<ll> arr(n,0);
  REP(i,0,m)arr[X[i]]=(ll)W[i];
  ll t=0;
  REP(i,0,m)t+=(ll)W[i];
  dp[0][0]=arr[0];dp[0][1]=0;
  dp[1][0]=arr[1];dp[1][1]=arr[0];
  REP(i,2,n){
    dp[i][1]=min(dp[i-1][0],dp[i-2][0]);
    dp[i][0]=min(dp[i-1][0],dp[i-1][1])+arr[i];
  }
  return max(t-dp[n-1][0],t-dp[n-1][1]);
}
# Verdict Execution time Memory Grader output
1 Correct 23 ms 9304 KB Output is correct
2 Correct 23 ms 10588 KB Output is correct
3 Correct 5 ms 6488 KB Output is correct
4 Correct 5 ms 6492 KB Output is correct
5 Correct 59 ms 19940 KB Output is correct
6 Correct 65 ms 20320 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 6 ms 6492 KB Output is correct
2 Correct 5 ms 6492 KB Output is correct
3 Correct 17 ms 8280 KB Output is correct
4 Correct 12 ms 8024 KB Output is correct
5 Incorrect 23 ms 10588 KB 1st lines differ - on the 1st token, expected: '1673106170551', found: '1673122841934'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 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 0 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 0 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 6 ms 6492 KB Output is correct
2 Correct 5 ms 6492 KB Output is correct
3 Correct 17 ms 8280 KB Output is correct
4 Correct 12 ms 8024 KB Output is correct
5 Incorrect 23 ms 10588 KB 1st lines differ - on the 1st token, expected: '1673106170551', found: '1673122841934'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 9304 KB Output is correct
2 Correct 23 ms 10588 KB Output is correct
3 Correct 5 ms 6488 KB Output is correct
4 Correct 5 ms 6492 KB Output is correct
5 Correct 59 ms 19940 KB Output is correct
6 Correct 65 ms 20320 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 -