답안 #724214

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
724214 2023-04-14T21:57:21 Z nihaddhuseynli 메기 농장 (IOI22_fish) C++17
12 / 100
101 ms 20948 KB
#include "fish.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
typedef long long int ll;
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,std::vector<int> W) {
    ll ans =0;
    ll a[300005];
    ll flag=0;
    for(int i =0;i<M;i++)
    {
        if(X[i]%2==1)
        {
            flag=1;
        }
        a[X[i]]+=W[i];
    }
    if(flag==0)
    {
        for(int i =0;i<M;i++)
        {
            ans+=W[i];
        }
    }
    else
    {
        ll dp[300005][2];
        memset(dp,0,sizeof(dp));
        dp[1][0]=a[1];
        dp[1][1]=a[0];
        for(int i =2;i<N;i++)
        {
            dp[i][0]=max(dp[i-1][1]+a[i],dp[i-1][0]);
            dp[i][1]=max({dp[i-2][0]+a[i-1],dp[i-1][1],dp[i-2][1]+a[i-1]});
        }
        ans=max(dp[N-1][0],dp[N-1][1]);
    }
    
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 10540 KB Output is correct
2 Correct 31 ms 11396 KB Output is correct
3 Correct 4 ms 7344 KB Output is correct
4 Correct 4 ms 7252 KB Output is correct
5 Correct 101 ms 20704 KB Output is correct
6 Correct 96 ms 20948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 7252 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7252 KB Output is correct
2 Correct 5 ms 7252 KB Output is correct
3 Correct 19 ms 9496 KB Output is correct
4 Correct 16 ms 8836 KB Output is correct
5 Correct 34 ms 10844 KB Output is correct
6 Correct 26 ms 10624 KB Output is correct
7 Correct 30 ms 10856 KB Output is correct
8 Correct 30 ms 10952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 7252 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 7252 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 7252 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7252 KB Output is correct
2 Correct 5 ms 7252 KB Output is correct
3 Correct 19 ms 9496 KB Output is correct
4 Correct 16 ms 8836 KB Output is correct
5 Correct 34 ms 10844 KB Output is correct
6 Correct 26 ms 10624 KB Output is correct
7 Correct 30 ms 10856 KB Output is correct
8 Correct 30 ms 10952 KB Output is correct
9 Incorrect 31 ms 10940 KB 1st lines differ - on the 1st token, expected: '99999', found: '66666'
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 10540 KB Output is correct
2 Correct 31 ms 11396 KB Output is correct
3 Correct 4 ms 7344 KB Output is correct
4 Correct 4 ms 7252 KB Output is correct
5 Correct 101 ms 20704 KB Output is correct
6 Correct 96 ms 20948 KB Output is correct
7 Incorrect 4 ms 7252 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
8 Halted 0 ms 0 KB -