#include <bits/stdc++.h>
#define ff first
#define ss second
#define sz size()
#define pb push_back
using namespace std;
typedef long long ll;
const int N = 300005;
ll a[102][102];
ll max_weights(int N, int M, vector <int> X, vector <int> Y, vector <int> W) {
ll mx = 0;
if (N > 2) {
for (int i = 0; i < M; ++i) {
a[X[i]][Y[i]] = W[i];
}
vector <ll> kl (N + 1, 0);
for (int i = N - 1; i >= 0; i--) {
kl[i] = max (kl[i + 1], a[1][i]);
}
for (int i = 1; i < N; ++i) {
mx = max (mx, a[0][i] + kl[i + 1]);
mx = max (mx, a[1][i]);
}
return (ll)mx;
}
for (int i = 0; i < M; ++i) {
if (Y[i]) mx = max (mx, (ll)W[i]);
}
return (ll)mx;
}
// int main () {
// cout << max_weights (4, 4, {0, 0, 1, 1}, {0, 1, 2, 3}, {3, 2, 5, 7}) << "\n";
// cout << max_weights (2, 2, {0, 1}, {0, 1}, {4, 3});
// }
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
23 ms |
4180 KB |
Execution killed with signal 11 |
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 |
2 ms |
2004 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
2004 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
23 ms |
4180 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |