# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
753490 | 2023-06-05T10:27:01 Z | armand | Catfish Farm (IOI22_fish) | C++17 | 91 ms | 13908 KB |
#include "fish.h" #include <algorithm> using namespace std; long long solve3(int n, int m, vector<int>& x, vector<int>& y, vector<int>& w) { int* a = new int [100001]; long long * b = new long long[100001]; int i; for (i = 0; i < m; i++) a[x[i]] = w[i]; } long long solve2(int n, int m, vector<int>& x, vector<int>& y, vector<int>& w) { int i, j; long long suma = 0, sumb = 0, ans, ans2=0, tmp; vector< pair<int, int> > a, b; for (i = 0; i < m; i++) if (x[i] == 0) { suma += w[i]; a.push_back(make_pair(y[i], w[i])); } else { sumb += w[i]; b.push_back(make_pair(y[i], w[i])); } ans = suma > sumb ? suma : sumb; if (n > 2) { sort(a.begin(), a.end()); sort(b.begin(), b.end()); ans2 = sumb; i = 0; j = 0; tmp = ans2; for (j = 0; j < b.size(); j++) { while (i < a.size() && a[i].first < b[j].first) { tmp += a[i].second; i++; } if (tmp > ans2) ans2 = tmp; if(i<a.size() && a[i].first == b[j].first) tmp += a[i++].second; tmp -= b[j].second; if (tmp > ans2) ans2 = tmp; } return ans > ans2 ? ans : ans2; } return ans; } long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) { int i; bool flag2 = true, flag3=true; long long ans = 0; for (i = 0; i < M; i++) { if (X[i] > 1) flag2 = false; if (Y[i] > 0) flag3 = false; } if (flag2) return solve2(N, M, X, Y, W); if (flag3) return solve3(N, M, X, Y, W); for (i = 0; i < W.size(); i++) ans += W[i]; return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 4676 KB | Output is correct |
2 | Correct | 46 ms | 5408 KB | Output is correct |
3 | Correct | 1 ms | 228 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 88 ms | 13636 KB | Output is correct |
6 | Correct | 91 ms | 13908 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 284 KB | Output is correct |
2 | Correct | 58 ms | 8480 KB | Output is correct |
3 | Correct | 72 ms | 10168 KB | Output is correct |
4 | Correct | 32 ms | 4696 KB | Output is correct |
5 | Correct | 37 ms | 5412 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 27 ms | 4692 KB | Output is correct |
13 | Correct | 43 ms | 5444 KB | Output is correct |
14 | Correct | 29 ms | 4448 KB | Output is correct |
15 | Correct | 32 ms | 4976 KB | Output is correct |
16 | Correct | 30 ms | 4556 KB | Output is correct |
17 | Correct | 37 ms | 4904 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 288 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 15 ms | 2388 KB | 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722970331638' |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 292 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 288 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Incorrect | 1 ms | 296 KB | 1st lines differ - on the 1st token, expected: '216624184325', found: '311850533155' |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 292 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 288 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Incorrect | 1 ms | 296 KB | 1st lines differ - on the 1st token, expected: '216624184325', found: '311850533155' |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 292 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 288 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Incorrect | 1 ms | 296 KB | 1st lines differ - on the 1st token, expected: '216624184325', found: '311850533155' |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 288 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 15 ms | 2388 KB | 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722970331638' |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 4676 KB | Output is correct |
2 | Correct | 46 ms | 5408 KB | Output is correct |
3 | Correct | 1 ms | 228 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 88 ms | 13636 KB | Output is correct |
6 | Correct | 91 ms | 13908 KB | Output is correct |
7 | Correct | 1 ms | 284 KB | Output is correct |
8 | Correct | 58 ms | 8480 KB | Output is correct |
9 | Correct | 72 ms | 10168 KB | Output is correct |
10 | Correct | 32 ms | 4696 KB | Output is correct |
11 | Correct | 37 ms | 5412 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 27 ms | 4692 KB | Output is correct |
19 | Correct | 43 ms | 5444 KB | Output is correct |
20 | Correct | 29 ms | 4448 KB | Output is correct |
21 | Correct | 32 ms | 4976 KB | Output is correct |
22 | Correct | 30 ms | 4556 KB | Output is correct |
23 | Correct | 37 ms | 4904 KB | Output is correct |
24 | Correct | 1 ms | 288 KB | Output is correct |
25 | Correct | 1 ms | 212 KB | Output is correct |
26 | Incorrect | 15 ms | 2388 KB | 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722970331638' |
27 | Halted | 0 ms | 0 KB | - |