# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1072310 |
2024-08-23T16:49:01 Z |
Boas |
Catfish Farm (IOI22_fish) |
C++17 |
|
55 ms |
10696 KB |
#include "fish.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T1, typename T2>
using indexed_map = tree<T1, T2, less<T1>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using indexed_set = indexed_map<T, null_type>;
#define loop(x, i) for (int i = 0; i < (x); i++)
#define loop1(x, i) for (int i = 1; i <= (x); i++)
#define rev(x, i) for (int i = (int)(x) - 1; i >= 0; i--)
#define itloop(x) for (auto it = begin(x); x != end(x); it++)
#define itrev(x) for (auto it = rbegin(x); x != rend(x); it++)
#define int long long
#define INF ((int64_t)(4e18 + 1))
#define INF32 ((int32_t)(2e9 + 1))
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
#define removeIn(x, l) l.erase(find(ALL(l), x))
#define pb push_back
#define sz(x) (int)(x).size()
#define F first
#define S second
#define var const auto &
#define foreach(l) for (var e : l)
typedef int8_t i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef tuple<int, int, int, int> iiii;
typedef vector<int> vi;
typedef vector<i32> vi32;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vii> vvii;
typedef vector<viii> vviii;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;
typedef vector<si> vsi;
typedef vector<sii> vsii;
typedef vector<vsi> vvsi;
typedef vector<string> vstr;
typedef vector<vector<string>> vvstr;
typedef vector<bool> vb;
typedef vector<vb> vvb;
int max_weights(i32 N, i32 M, vi32 X, vi32 Y, vi32 W)
{
vi pSum0 = {0}, pSum1 = {0};
vi at0(N), at1(N);
loop(M, i)
{
if (X[i] == 0)
at0[Y[i]] = W[i];
else
at1[Y[i]] = W[i];
}
loop(N, i)
{
pSum0.pb(pSum0.back() + at0[i]);
pSum1.pb(pSum1.back() + at1[i]);
}
int res = 0;
loop(N + 1, h1)
{
res = max(res, pSum1.back() - pSum1[h1] + pSum0[h1]);
}
if (N == 2)
return max(pSum0.back(), pSum1.back());
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
5328 KB |
Output is correct |
2 |
Correct |
19 ms |
6092 KB |
Output is correct |
3 |
Correct |
3 ms |
3784 KB |
Output is correct |
4 |
Correct |
3 ms |
3616 KB |
Output is correct |
5 |
Incorrect |
55 ms |
10696 KB |
1st lines differ - on the 1st token, expected: '149814460735479', found: '49851995244248' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
30 ms |
7336 KB |
Output is correct |
3 |
Correct |
38 ms |
8284 KB |
Output is correct |
4 |
Correct |
15 ms |
5324 KB |
Output is correct |
5 |
Correct |
19 ms |
6088 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
3660 KB |
Output is correct |
11 |
Correct |
3 ms |
3784 KB |
Output is correct |
12 |
Correct |
15 ms |
5324 KB |
Output is correct |
13 |
Correct |
18 ms |
6088 KB |
Output is correct |
14 |
Correct |
18 ms |
6944 KB |
Output is correct |
15 |
Correct |
18 ms |
7376 KB |
Output is correct |
16 |
Correct |
19 ms |
6744 KB |
Output is correct |
17 |
Correct |
21 ms |
7368 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
3784 KB |
Output is correct |
2 |
Correct |
2 ms |
3592 KB |
Output is correct |
3 |
Incorrect |
11 ms |
5792 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '774766749' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '2268305442' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '2268305442' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '2268305442' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
3784 KB |
Output is correct |
2 |
Correct |
2 ms |
3592 KB |
Output is correct |
3 |
Incorrect |
11 ms |
5792 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '774766749' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
5328 KB |
Output is correct |
2 |
Correct |
19 ms |
6092 KB |
Output is correct |
3 |
Correct |
3 ms |
3784 KB |
Output is correct |
4 |
Correct |
3 ms |
3616 KB |
Output is correct |
5 |
Incorrect |
55 ms |
10696 KB |
1st lines differ - on the 1st token, expected: '149814460735479', found: '49851995244248' |
6 |
Halted |
0 ms |
0 KB |
- |