Submission #696116

#TimeUsernameProblemLanguageResultExecution timeMemory
696116penguin133Team Contest (JOI22_team)C++17
8 / 100
2077 ms10484 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pi pair<int, int> #define pii pair<int, pi> #define fi first #define se second #ifdef _WIN32 #define getchar_unlocked _getchar_nolock #endif mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); int n, A[150005], B[150005], C[150005]; vector <pii> lmao; void solve(){ cin >> n; for(int i=1;i<=n;i++)cin >> A[i] >> B[i] >> C[i], lmao.push_back({A[i], {B[i], C[i]}}); sort(lmao.begin(), lmao.end()); int ans = -1; for(int i=1;i<=n;i++)A[i] = lmao[i-1].fi, B[i] = lmao[i-1].se.fi, C[i] = lmao[i-1].se.se;// cout << A[i] << ' ' <<B[i] << ' ' << C[i] << '\n'; for(int i=1;i<=n;i++){ for(int j=i+1;j<=n;j++){ for(int k=j+1;k<=n;k++){ if(A[k] <= A[i] || A[k] <= A[j])continue; bool f = 1, f2 = 1; //cout << i << ' ' << j << ' ' << k << '\n'; if(B[j] <= B[i] || B[j] <= B[k] || C[i] <= C[k] || C[i] <= C[j])f = 0; if(B[i] <= B[j] || B[i] <= B[k] || C[j] <= C[k] || C[j] <= C[i])f2 = 0; if(f)ans = max(ans, A[k] + B[j] + C[i]); if(f2)ans = max(ans, A[k] + B[i] + C[j]); } } } cout << ans; } main(){ ios::sync_with_stdio(0);cin.tie(0); int tc = 1; //cin >> tc; for(int tc1=1;tc1<=tc;tc1++){ // cout << "Case #" << tc1 << ": "; solve(); } }

Compilation message (stderr)

team.cpp:39:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   39 | main(){
      | ^~~~
#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...