Submission #859466

# Submission time Handle Problem Language Result Execution time Memory
859466 2023-10-10T07:58:50 Z kim Catfish Farm (IOI22_fish) C++17
9 / 100
59 ms 19712 KB
#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define pb push_back
#define pii pair<int,int>
#define f first
#define s second

struct A{
    int x,y,w;
    A(int x_,int y_,int w_):x(x_),y(y_),w(w_){}

    static bool cmpX(const A&l,const A&r){
        if(l.x==r.x) return l.y<r.y;
        return l.x<r.x;
    }
    static bool cmpY(const A&l,const A&r){
        if(l.y==r.y) return l.x<r.x;
        return l.y<r.y;
    }

};
vector<A> fish;
int dp[100005][3];
int n,m;
vector<pii> fx[100005],fy[100005];

ll max_weights(int32_t N,int32_t M,vector<int32_t> X,vector<int32_t> Y,vector<int32_t> W) {
    n=N;
    m=M;
    int sum=0;
    for(int i=0;i<M;++i){
        fish.emplace_back(X[i],Y[i],W[i]);
        if(Y[1]==1) sum+=W[i];
        fx[X[i]].emplace_back(Y[i],W[i]);
        fy[Y[i]].emplace_back(X[i],W[i]);
        if(X[i]==0) dp[0][1]=W[i];
    }
    sort(fish.begin(),fish.end(),A::cmpY);
    for(int i=1;i<N;++i){
        dp[i][0]=max({dp[i-1][0],dp[i-1][1],dp[i-1][2]});
        if(fx[i].size()){
            dp[i][1]=dp[i-1][0]+fx[i][0].s;
            if(i>1) dp[i][2]=dp[i-1][1]+fx[i][0].s;
            else dp[i][2]=0;
        }
        else dp[i][1]=dp[i][2]=0;
    }
    return max(dp[N-1][1],dp[N-1][0]);

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 17320 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 6748 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 2 ms 7260 KB Output is correct
2 Correct 2 ms 7260 KB Output is correct
3 Correct 22 ms 13120 KB Output is correct
4 Correct 16 ms 11336 KB Output is correct
5 Correct 41 ms 18324 KB Output is correct
6 Correct 42 ms 17652 KB Output is correct
7 Correct 40 ms 18244 KB Output is correct
8 Correct 42 ms 18264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 6748 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 6748 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 6748 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 2 ms 7260 KB Output is correct
2 Correct 2 ms 7260 KB Output is correct
3 Correct 22 ms 13120 KB Output is correct
4 Correct 16 ms 11336 KB Output is correct
5 Correct 41 ms 18324 KB Output is correct
6 Correct 42 ms 17652 KB Output is correct
7 Correct 40 ms 18244 KB Output is correct
8 Correct 42 ms 18264 KB Output is correct
9 Incorrect 59 ms 19712 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 Incorrect 38 ms 17320 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -