#include "fish.h"
#include <vector>
#include <iostream>
#define ll long long
using namespace std;
long long max_weights(int N, int M, vector<int> X, vector<int> Y,
vector<int> W) {
vector<vector<int>> grid(N,vector<int>(N,0));
vector<int> length(N,0);
for(int i=0;i<M;i++)grid[X[i]][Y[i]] = W[i];
for(int i=1;i<N;i++){
ll left = 0,cur = 0;
int height = 0;
for(int j=0;j<N;j++){
left += grid[i-1][j];
cur += grid[i][j];
if(left>cur){
height = j;
left = 0;
}
}
length[i]=height;
}
// for(int i=0;i<N;i++){
// cout << length[i] << " ";
// }cout << endl;
ll ans = 0;
for(int i=0;i<M;i++){
if(length[X[i]] >= Y[i]) continue;
if(X[i] != 0 && length[X[i]-1] >= Y[i])ans += W[i];
if(X[i] != N-1 && length[X[i]+1] >= Y[i])ans += W[i];
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
887 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
685 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
685 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
887 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |