# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
625999 | 2022-08-11T06:08:03 Z | sword060 | 메기 농장 (IOI22_fish) | C++17 | 129 ms | 11476 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>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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 3276 KB | Output is correct |
2 | Correct | 35 ms | 3780 KB | Output is correct |
3 | Correct | 1 ms | 980 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 114 ms | 11476 KB | Output is correct |
6 | Correct | 129 ms | 11476 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 61 ms | 5696 KB | Output is correct |
3 | Correct | 75 ms | 6720 KB | Output is correct |
4 | Correct | 34 ms | 3280 KB | Output is correct |
5 | Correct | 38 ms | 3780 KB | Output is correct |
6 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 980 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 29 ms | 3304 KB | Output is correct |
13 | Correct | 34 ms | 3780 KB | Output is correct |
14 | Correct | 29 ms | 3080 KB | Output is correct |
15 | Correct | 34 ms | 3416 KB | Output is correct |
16 | Correct | 28 ms | 3180 KB | Output is correct |
17 | Correct | 33 ms | 3396 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 980 KB | Output is correct |
2 | Correct | 1 ms | 980 KB | Output is correct |
3 | Incorrect | 15 ms | 2760 KB | 1st lines differ - on the 1st token, expected: '21261825233649', found: '16359027219341' |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | 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 | - |
# | 결과 | 실행 시간 | 메모리 | 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 | - |
# | 결과 | 실행 시간 | 메모리 | 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 | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 980 KB | Output is correct |
2 | Correct | 1 ms | 980 KB | Output is correct |
3 | Incorrect | 15 ms | 2760 KB | 1st lines differ - on the 1st token, expected: '21261825233649', found: '16359027219341' |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 3276 KB | Output is correct |
2 | Correct | 35 ms | 3780 KB | Output is correct |
3 | Correct | 1 ms | 980 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 114 ms | 11476 KB | Output is correct |
6 | Correct | 129 ms | 11476 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 61 ms | 5696 KB | Output is correct |
9 | Correct | 75 ms | 6720 KB | Output is correct |
10 | Correct | 34 ms | 3280 KB | Output is correct |
11 | Correct | 38 ms | 3780 KB | Output is correct |
12 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 980 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 29 ms | 3304 KB | Output is correct |
19 | Correct | 34 ms | 3780 KB | Output is correct |
20 | Correct | 29 ms | 3080 KB | Output is correct |
21 | Correct | 34 ms | 3416 KB | Output is correct |
22 | Correct | 28 ms | 3180 KB | Output is correct |
23 | Correct | 33 ms | 3396 KB | Output is correct |
24 | Correct | 1 ms | 980 KB | Output is correct |
25 | Correct | 1 ms | 980 KB | Output is correct |
26 | Incorrect | 15 ms | 2760 KB | 1st lines differ - on the 1st token, expected: '21261825233649', found: '16359027219341' |
27 | Halted | 0 ms | 0 KB | - |