# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1043154 | ezzzay | Prisoner Challenge (IOI22_prison) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
#include <vector>
#define ll long long
const int MN=3e5;
int ps[MN][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++){
ps[Y[i]][X[i]]+=W[i];
}
for(int i=1;i<MN;i++){
ps[i][0]+=ps[i-1][0];
ps[i][1]+=ps[i-1][1];
}
for(int i=0;i<N;i++){
ans=max(ans,ps[N+5][0]-ps[i][0]+ps[i][1]);
}
ans=max(ans,ps[N+5][0]);
ans=max(ans,ps[N+5][1]);
}