| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1335995 | i271828 | Catfish Farm (IOI22_fish) | C++20 | 51 ms | 8032 KiB |
#include "fish.h"
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;
const int MAX=1e5+5;
const ll INF=1LL<<60;
ll C[MAX];
ll dp[2][2];
ll nxt[2][2];
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W){
for (int i=0;i<M;i++) C[X[i]]+=W[i];
for (int a=0;a<2;a++) for (int b=0;b<2;b++) dp[a][b]=-INF;
dp[0][0]=0;
for (int i=0;i<N;i++){
nxt[0][0]=max(dp[0][0],dp[1][0]);
nxt[0][1]=C[i]+max(dp[0][0],dp[1][0]);
nxt[1][0]=max(dp[0][1],(i>0?C[i-1]:0)+dp[1][1]);
nxt[1][1]=max(dp[0][1],dp[1][1]);
swap(nxt,dp);
}
ll ans=0;
for (int a=0;a<2;a++) for (int b=0;b<2;b++) ans=max(ans,dp[a][b]);
return ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
