# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1055961 |
2024-08-13T06:50:10 Z |
pawned |
Catfish Farm (IOI22_fish) |
C++17 |
|
111 ms |
13896 KB |
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
#include "fish.h"
int MAX_R = 10;
int MAX_C = 10;
ll max_weights(int N, int M, vector<int> X_g, vector<int> Y_g, vector<int> W_g) {
MAX_R = min(N, 3);
MAX_C = N;
vector<vi> a(MAX_R, vi(MAX_C, 0));
for (int i = 0; i < M; i++) {
if (X_g[i] < MAX_R && Y_g[i] < MAX_C)
a[X_g[i]][Y_g[i]] += W_g[i];
}
/* cout<<"a: "<<endl;
for (vi v : a) {
for (ll x : v)
cout<<x<<" ";
cout<<endl;
}*/
vector<vi> pfs(MAX_R, vi(MAX_C + 1, 0)); // vertical pfs
for (int i = 0; i < MAX_R; i++) {
pfs[i][0] = 0;
for (int j = 1; j <= MAX_C; j++) {
pfs[i][j] = pfs[i][j - 1] + a[i][j - 1];
}
}
/* cout<<"pfs: "<<endl;
for (vi v : pfs) {
for (ll x : v)
cout<<x<<" ";
cout<<endl;
}*/
if (N == 2) {
return max(pfs[0][N], pfs[1][N]);
}
else {
ll ans = 0;
for (int i = 0; i <= N; i++) {
ans = max(ans, (pfs[0][i] - pfs[0][0]) + (pfs[1][N] - pfs[1][i]));
}
return ans;
}
}
// subtask 2: greedy
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
7068 KB |
Output is correct |
2 |
Correct |
15 ms |
8268 KB |
Output is correct |
3 |
Correct |
2 ms |
5708 KB |
Output is correct |
4 |
Correct |
3 ms |
5704 KB |
Output is correct |
5 |
Incorrect |
111 ms |
12896 KB |
1st lines differ - on the 1st token, expected: '149814460735479', found: '0' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
27 ms |
11420 KB |
Output is correct |
3 |
Correct |
35 ms |
13896 KB |
Output is correct |
4 |
Correct |
14 ms |
8604 KB |
Output is correct |
5 |
Correct |
16 ms |
9796 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 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
5792 KB |
Output is correct |
11 |
Correct |
3 ms |
5708 KB |
Output is correct |
12 |
Correct |
13 ms |
8496 KB |
Output is correct |
13 |
Correct |
17 ms |
9916 KB |
Output is correct |
14 |
Correct |
14 ms |
8492 KB |
Output is correct |
15 |
Correct |
15 ms |
9548 KB |
Output is correct |
16 |
Correct |
14 ms |
8600 KB |
Output is correct |
17 |
Correct |
16 ms |
9532 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
5704 KB |
Output is correct |
2 |
Incorrect |
2 ms |
5708 KB |
1st lines differ - on the 1st token, expected: '882019', found: '0' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 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 |
348 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 |
348 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 |
3 ms |
5704 KB |
Output is correct |
2 |
Incorrect |
2 ms |
5708 KB |
1st lines differ - on the 1st token, expected: '882019', found: '0' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
7068 KB |
Output is correct |
2 |
Correct |
15 ms |
8268 KB |
Output is correct |
3 |
Correct |
2 ms |
5708 KB |
Output is correct |
4 |
Correct |
3 ms |
5704 KB |
Output is correct |
5 |
Incorrect |
111 ms |
12896 KB |
1st lines differ - on the 1st token, expected: '149814460735479', found: '0' |
6 |
Halted |
0 ms |
0 KB |
- |