# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
829285 | 2023-08-18T08:15:12 Z | FatihSolak | Catfish Farm (IOI22_fish) | C++17 | 1000 ms | 25012 KB |
#include "fish.h" #include <bits/stdc++.h> using namespace std; long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W){ vector<pair<int,int>> v[N]; vector<long long>pre[N]; for(int i = 0;i<M;i++){ v[X[i]].push_back({Y[i],W[i]}); } for(int i = 0;i<N;i++){ v[i].push_back({N,0}); sort(v[i].begin(),v[i].end()); pre[i].assign(v[i].size(),0); for(int j = 0;j<v[i].size();j++){ pre[i][j] = v[i][j].second + (j?pre[i][j-1]:0); } } vector<pair<int,long long>> dp[N + 1]; dp[0].push_back({0,0}); for(int i = 0;i<N;i++){ vector<pair<int,long long>> ndp[N + 1]; for(int y = 0;y<N + 1;y++){ for(auto u:dp[y]){ for(auto c:v[i]){ long long val = u.second; if(c.first - 1 <= u.first){ for(auto x:v[i]){ if(c.first-1 < x.first && x.first <= u.first) val += x.second; } } else{ if(i){ for(auto x:v[i-1]){ if(u.first < x.first && y-1 < x.first && x.first <= c.first - 1) val += x.second; } } } ndp[u.first + 1].push_back({c.first - 1,val}); } } } for(int j = 0;j<N + 1;j++){ sort(ndp[j].begin(),ndp[j].end()); vector<pair<int,long long>> tmp; for(auto u:ndp[j]){ if(tmp.empty() || u.first != tmp.back().first) tmp.push_back(u); else tmp.back().second = max(tmp.back().second,u.second); } ndp[j] = tmp; dp[j] = ndp[j]; } } long long ans = 0; for(int i = 0;i<N + 1;i++){ for(auto c:dp[i]){ ans = max(ans,c.second); } } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1067 ms | 21808 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Execution timed out | 1066 ms | 25012 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1060 ms | 15828 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 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 | 1 ms | 340 KB | Output is correct |
10 | Correct | 11 ms | 468 KB | Output is correct |
11 | Correct | 3 ms | 340 KB | Output is correct |
12 | Correct | 3 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Incorrect | 3 ms | 340 KB | 1st lines differ - on the 1st token, expected: '360901324355', found: '361116090878' |
15 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 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 | 1 ms | 340 KB | Output is correct |
10 | Correct | 11 ms | 468 KB | Output is correct |
11 | Correct | 3 ms | 340 KB | Output is correct |
12 | Correct | 3 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Incorrect | 3 ms | 340 KB | 1st lines differ - on the 1st token, expected: '360901324355', found: '361116090878' |
15 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 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 | 1 ms | 340 KB | Output is correct |
10 | Correct | 11 ms | 468 KB | Output is correct |
11 | Correct | 3 ms | 340 KB | Output is correct |
12 | Correct | 3 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Incorrect | 3 ms | 340 KB | 1st lines differ - on the 1st token, expected: '360901324355', found: '361116090878' |
15 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1060 ms | 15828 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1067 ms | 21808 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |