# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
918597 | manishjha91 | Team Contest (JOI22_team) | C++17 | 290 ms | 16556 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using lld = long double;
const int inf = 1e9;
// #ifndef ONLINE_JUDGE
// #include "E:\Personal\cpp_codes\debugalgo.h"
// #else
// #define debug(x)
// #endif
void solve()
{
int n;
cin >> n;
vector<array<int,3>> a(n);
int mxx = 0, mxy = 0, mxz = 0;
for (int i = 0; i < n; i++)
{
cin >> a[i][0]>>a[i][1]>>a[i][2];
}
priority_queue<pair<int,int>> pq[3];
set<int> banned;
for(int i=0; i<n; i++)
{
for(int j=0; j<3; j++)
{
pq[j].push({a[i][j],i});
}
}
int ans = -1;
while(!pq[0].empty() && !pq[1].empty() && !pq[1].empty())
{
for(int j=0; j<3; j++)
{
while(!pq[j].empty() && banned.count(pq[j].top().second))
{
pq[j].pop();
}
}
if(pq[0].empty() || pq[1].empty() || pq[1].empty()) break;
int mxx = pq[0].top().first;
int mxy = pq[1].top().first;
int mxz = pq[2].top().first;
if(a[pq[0].top().second][1]>=mxy || a[pq[0].top().second][2]>=mxz)
{
banned.insert(pq[0].top().second);
continue;
}
if(a[pq[1].top().second][2]>=mxz || a[pq[1].top().second][0]>=mxx)
{
banned.insert(pq[1].top().second);
continue;
}
if(a[pq[2].top().second][1]>=mxy || a[pq[2].top().second][0]>=mxx)
{
banned.insert(pq[2].top().second);
continue;
}
ans = max(ans,mxx + mxy + mxz);
break;
}
cout<<ans<<"\n";
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
// #ifndef ONLINE_JUDGE
// freopen("error.txt", "w", stderr);
// #endif
int tt = 1;
// cin >> tt;
while (tt--)
{
solve();
}
}
컴파일 시 표준 에러 (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... |