Submission #712546

# Submission time Handle Problem Language Result Execution time Memory
712546 2023-03-19T06:56:10 Z josanneo22 Catfish Farm (IOI22_fish) C++17
0 / 100
55 ms 18080 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<int>> grid(n, vector<int>(2,0));
    for (int i = 0; i < m; i++) {
        if (x[i] == 0) mx1 = max(mx1, y[i]);
        else mx2 = max(mx2, y[i]);
        grid[x[i]][y[i]] = w[i];
    }
    if (mx1 == -1 || mx2 == -1) {
        return accumulate(w.begin(), w.end(),0LL);
    }
    else {
        long long ans = 0;
        for (int i = min(mx1, mx2) + 1; i <= max(mx1, mx2); 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 Runtime error 31 ms 14180 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 55 ms 18080 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 5716 KB Output is correct
2 Correct 6 ms 5716 KB Output is correct
3 Incorrect 22 ms 6448 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '524570896'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 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 0 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 0 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 5 ms 5716 KB Output is correct
2 Correct 6 ms 5716 KB Output is correct
3 Incorrect 22 ms 6448 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '524570896'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 31 ms 14180 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -