# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
829272 | FatihSolak | Catfish Farm (IOI22_fish) | C++17 | 55 ms | 21856 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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+1,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]){
array<long long,3> nw;
nw[0] = u.first;
nw[1] = c.first-1;
nw[2] = u.second;
// if(c.first - 1 <= u.first){
// for(auto x:v[i]){
// if(c.first-1 < x.first && x.first <= u.first)
// nw[2] += 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)
// nw[2] += x.second;
// }
// }
// }
if(nw[0] + 1 < 0 || nw[0] + 1 > N)
return 0;
ndp[nw[0] + 1].push_back({nw[1],nw[2]});
}
}
}
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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |