# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
556213 | 600Mihnea | Team Contest (JOI22_team) | C++17 | 2071 ms | 2588 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
bool home = 1;
using namespace std;
struct T {
int x;
int y;
int z;
};
bool cmp_x_inv(T a,T b) {
return a.x>b.x;
}
typedef long long ll;
const int N=150000+7;
const int INF=(int)1e9+7;
int n,zm[N];
T a[N];
signed main() {
#ifdef ONLINE_JUDGE
home = 0;
#endif
home=0;
if (home) {
freopen("I_am_iron_man", "r", stdin);
}
else {
ios::sync_with_stdio(0); cin.tie(0);
}
cin>>n;
for (int i=1;i<=n;i++) {
cin>>a[i].x>>a[i].y>>a[i].z;
}
sort(a+1,a+n+1,cmp_x_inv);
int print=-1;
for (int ITER=0;ITER<2;ITER++) {
int last=n;
for (int i=n;i>=1;i--) { /// optimize using aib
zm[i]=-INF;
for (int j=i+1;j<=n;j++) {
if (a[i].y>a[j].y) {
zm[i]=max(zm[i],a[j].z);
}
}
if (zm[i]<=a[i].z) zm[i]=-INF;
}
while(last>=1){
int first=last;
while(first-1>=1&&a[first-1].x==a[first].x) first--;
for (int i=first;i<=last;i++) {
int best=-INF;
int y=a[i].y,z=a[i].z;
for (int j=last+1;j<=n;j++) {
if (a[j].y>y&&zm[j]>z) {
best=max(best,zm[j]+a[j].y);
}
}
print=max(print,best+a[i].x);
}
last=first-1;
}
for (int i=1;i<=n;i++) swap(a[i].y,a[i].z);
}
cout<<print<<"\n";
}
컴파일 시 표준 에러 (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... |