Submission #712552

# Submission time Handle Problem Language Result Execution time Memory
712552 2023-03-19T07:02:14 Z josanneo22 Catfish Farm (IOI22_fish) C++17
0 / 100
101 ms 25700 KB
#include "fish.h"
#include<bits/stdc++.h>
#include<iostream>
#include<math.h>
#include <vector>
using namespace std;
long long max_weights(int n, int m, std::vector<int> x, std::vector<int> y,std::vector<int> w) {
    int mx1 = -1, mx2 = -1;
    vector<vector<long long>> grid(n, vector<long long>(2,0LL));
    for (int i = 0; i < m; i++) {
        if (x[i] == 0) mx1 = max(mx1, y[i]);
        else mx2 = max(mx2, y[i]);
        grid[y[i]][x[i]] = w[i];
    }
    if (mx1 == -1 || mx2 == -1) {
        long long ans = 0;
        for (int i = 0; i < m; i++) {
            ans += (long long)w[i];
        }
        return ans;
    }
    else {
        long long ans = 0;
        for (int i = min(mx1, mx2) + 1; i <= max(mx1, mx2) && i<=n-1; i++) {
            ans += grid[i][0] + grid[i][1];
        }
        long long meow0 = 0,meow1 = 0;
        for (int i = min(mx1, mx2); i >= 0;i--) {
            meow0 += grid[i][0];
            meow1 += grid[i][1];
        }
        return ans + max(meow0,meow1);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 37 ms 7116 KB Output is correct
2 Correct 34 ms 8020 KB Output is correct
3 Correct 7 ms 5716 KB Output is correct
4 Correct 6 ms 5716 KB Output is correct
5 Runtime error 101 ms 25700 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 54 ms 8984 KB 1st lines differ - on the 1st token, expected: '40604614618209', found: '40479197388443'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 5716 KB Output is correct
2 Runtime error 11 ms 11476 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 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 212 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 212 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 5716 KB Output is correct
2 Runtime error 11 ms 11476 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 7116 KB Output is correct
2 Correct 34 ms 8020 KB Output is correct
3 Correct 7 ms 5716 KB Output is correct
4 Correct 6 ms 5716 KB Output is correct
5 Runtime error 101 ms 25700 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -