제출 #918597

#제출 시각아이디문제언어결과실행 시간메모리
918597manishjha91Team Contest (JOI22_team)C++17
100 / 100
290 ms16556 KiB
#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) 메시지

team.cpp: In function 'void solve()':
team.cpp:23:6: warning: unused variable 'mxx' [-Wunused-variable]
   23 |  int mxx = 0, mxy = 0, mxz = 0;
      |      ^~~
team.cpp:23:15: warning: unused variable 'mxy' [-Wunused-variable]
   23 |  int mxx = 0, mxy = 0, mxz = 0;
      |               ^~~
team.cpp:23:24: warning: unused variable 'mxz' [-Wunused-variable]
   23 |  int mxx = 0, mxy = 0, mxz = 0;
      |                        ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...