Submission #925194

# Submission time Handle Problem Language Result Execution time Memory
925194 2024-02-11T00:39:54 Z IS_Rushdi Catfish Farm (IOI22_fish) C++17
6 / 100
67 ms 9292 KB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;


long long max_weights(int n,int m,vector<int>x,vector<int>y,vector<int>w){
    // long long pre[n+1][n+1]{};
    // for(int i = 0; i < m; i++) x[i]++,y[i]++;
    // for(int i = 0; i < m; i++) pre[x[i]][y[i]] += w[i];
    // for(int i = 1; i <= n; i++){
    //     for(int j = 1; j <= n; j++){
    //         pre[i][j] += pre[i][j-1];
    //     }
    // }
    
    long long ans = 0;
    long long ans2 = 0;
    int cost[n][2]{};
    for(int i = 0; i < m; i++){
        if(x[i] == 1){cost[y[i]][1] = w[i]; ans += w[i];}
        if(x[i] == 0){ans2 += w[i];cost[y[i]][0]=w[i];}
    }
    if(n == 2 || n == 1) return max(ans,ans2);
    ans2 = max(ans,ans2);
    
    for(int i = 1; i < n; i++){
        ans -= cost[i-1][1];
        ans += cost[i-1][0];

        ans2 = max(ans2,ans);
    }
    return ans2;
}

// int main(){
//     cout << max_weights(5, 4, {0, 1, 4, 3}, {2, 1, 4, 3}, {5, 2, 1, 3}) << '\n';
// }
# Verdict Execution time Memory Grader output
1 Correct 18 ms 2904 KB Output is correct
2 Correct 22 ms 3408 KB Output is correct
3 Correct 1 ms 1116 KB Output is correct
4 Correct 1 ms 1116 KB Output is correct
5 Incorrect 67 ms 8052 KB 1st lines differ - on the 1st token, expected: '149814460735479', found: '0'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 36 ms 4692 KB Output is correct
3 Correct 45 ms 9292 KB Output is correct
4 Correct 21 ms 4184 KB Output is correct
5 Correct 26 ms 5332 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1112 KB Output is correct
12 Correct 18 ms 4444 KB Output is correct
13 Correct 23 ms 5152 KB Output is correct
14 Correct 19 ms 4444 KB Output is correct
15 Correct 21 ms 4696 KB Output is correct
16 Correct 21 ms 4436 KB Output is correct
17 Correct 25 ms 4672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1116 KB Output is correct
2 Incorrect 1 ms 1116 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
3 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 1 ms 1116 KB Output is correct
2 Incorrect 1 ms 1116 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 2904 KB Output is correct
2 Correct 22 ms 3408 KB Output is correct
3 Correct 1 ms 1116 KB Output is correct
4 Correct 1 ms 1116 KB Output is correct
5 Incorrect 67 ms 8052 KB 1st lines differ - on the 1st token, expected: '149814460735479', found: '0'
6 Halted 0 ms 0 KB -