# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
626002 | 2022-08-11T06:13:11 Z | sword060 | Catfish Farm (IOI22_fish) | C++17 | 77 ms | 6724 KB |
#include <bits/stdc++.h> #include "fish.h" using namespace std; long long max_weights(int x,int k,vector<int> a,vector<int> b,vector<int> c){ vector<pair<int,int>>l[2]; long long ans=0,cur=0,cur2=0; bool f=1; for(int i=0;i<k;i++){ l[a[i]%2].push_back({b[i],c[i]}); if(a[i]%2)cur+=c[i]; else cur2+=c[i]; f&=(b[i]==0); } if(f){ long long dp[x+1]; for(int i=0;i<x;i++)dp[i]=0; for(int i=0;i<k;i++)dp[a[i]]+=c[i]; for(int i=0;i<x;i++){ if(i<x-1&&i>0)dp[i]+=max(dp[i-1],dp[i+1]); if(i>2)dp[i]+=max(dp[i-2],dp[i-3]); else if(i>1)dp[i]+=dp[i-2]; ans=max(ans,dp[i]); } return ans; } sort(l[0].begin(),l[0].end()); sort(l[1].begin(),l[1].end()); ans=cur; if(x<=2){ return max(cur,cur2); } int j=0; for(int i=0;i<(int)l[0].size();i++){ cur+=l[0][i].second; while(j<l[1].size()&&l[1][j].first<=l[0][i].first){ cur-=l[1][j].second; j++; } ans=max(ans,cur); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 3276 KB | Output is correct |
2 | Correct | 37 ms | 3788 KB | Output is correct |
3 | Incorrect | 1 ms | 980 KB | 1st lines differ - on the 1st token, expected: '10082010', found: '5961358723507376790' |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 59 ms | 5688 KB | Output is correct |
3 | Correct | 77 ms | 6724 KB | Output is correct |
4 | Correct | 29 ms | 3276 KB | Output is correct |
5 | Correct | 36 ms | 3772 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Incorrect | 1 ms | 980 KB | 1st lines differ - on the 1st token, expected: '10082010', found: '5961358723507376790' |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 980 KB | 1st lines differ - on the 1st token, expected: '10082010', found: '5961358723507376790' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 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 | 212 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 | 212 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 | 1 ms | 980 KB | 1st lines differ - on the 1st token, expected: '10082010', found: '5961358723507376790' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 3276 KB | Output is correct |
2 | Correct | 37 ms | 3788 KB | Output is correct |
3 | Incorrect | 1 ms | 980 KB | 1st lines differ - on the 1st token, expected: '10082010', found: '5961358723507376790' |
4 | Halted | 0 ms | 0 KB | - |