Submission #892180

#TimeUsernameProblemLanguageResultExecution timeMemory
892180vjudge1Team Contest (JOI22_team)C++17
8 / 100
68 ms4688 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define all(x) x.begin(),x.end() #define ff first #define ss second const long long INF = 1e18; const int N = 1e5 + 1; signed main(){ int n; cin >> n; int x[n],y[n],z[n]; for(int i = 0;i < n;i++){ cin >> x[i] >> y[i] >> z[i]; } if(n <= 300){ int ans = -1; for(int i = 0;i < n;i++){ for(int j = 0;j < n;j++){ for(int k = 0;k < n;k++){ if(i != j && i != k && j != k){ if(x[i] > x[j] && x[i] > x[k] && y[j] > y[i] && y[j] > y[k] && z[k] > z[i] && z[k] > z[j]){ ans = max(ans,x[i] + y[j] + z[k]); } } } } } cout << ans; } else{ int cnt[6][6][6] {}; for(int i = 0;i < n;i++){ cnt[x[i]][y[i]][z[i]]++; } vector<pair<pair<int,int>,int>> g; for(int x1 = 1;x1 <= 5;x1++){ for(int y1 = 1;y1 <= 5;y1++){ for(int z1 = 1;z1 <= 5;z1++){ // if(x1) g.pb({{x1,y1},z1}); } } } int ans = 0; for(int i = 0;i < g.size();i++){ for(int j = 0;j < g.size();j++){ for(int k = 0;k < g.size();k++){ // auto [a,b] = g[i]; // auto [h,q] = auto [ai,bi] = g[i]; auto [aj,bj] = g[j]; auto [ak,bk] = g[k]; if(ai.ff > aj.ff && ai.ff > ak.ff && aj.ss > ai.ss && aj.ss > ak.ss && bk > bi && bk > bj){ } else{ continue; } int x1 = g[i].ff.ff,y1 = g[i].ff.ss,z1 = g[i].ss; if(cnt[x1][y1][z1] > 0){ cnt[x1][y1][z1]--; } else{ continue; } x1 = g[j].ff.ff,y1 = g[j].ff.ss,z1 = g[j].ss; if(cnt[x1][y1][z1] > 0){ cnt[x1][y1][z1]--; } else{ x1 = g[i].ff.ff,y1 = g[i].ff.ss,z1 = g[i].ss; cnt[x1][y1][z1]++; continue; } x1 = g[k].ff.ff,y1 = g[k].ff.ss,z1 = g[k].ss; if(cnt[x1][y1][z1] > 0){ cnt[x1][y1][z1]--; } else{ x1 = g[i].ff.ff,y1 = g[i].ff.ss,z1 = g[i].ss; cnt[x1][y1][z1]++; x1 = g[j].ff.ff,y1 = g[j].ff.ss,z1 = g[j].ss; cnt[x1][y1][z1]++; continue; } x1 = g[i].ff.ff,y1 = g[i].ff.ss,z1 = g[i].ss; cnt[x1][y1][z1]++; x1 = g[j].ff.ff,y1 = g[j].ff.ss,z1 = g[j].ss; cnt[x1][y1][z1]++; x1 = g[k].ff.ff,y1 = g[k].ff.ss,z1 = g[k].ss; cnt[x1][y1][z1]++; ans = max(ans,ai.ff + aj.ss + bk); } } } cout << ans; } }

Compilation message (stderr)

team.cpp: In function 'int main()':
team.cpp:51:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<std::pair<long long int, long long int>, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |   for(int i = 0;i < g.size();i++){
      |                 ~~^~~~~~~~~~
team.cpp:52:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<std::pair<long long int, long long int>, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |    for(int j = 0;j < g.size();j++){
      |                  ~~^~~~~~~~~~
team.cpp:53:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<std::pair<long long int, long long int>, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |     for(int k = 0;k < g.size();k++){
      |                   ~~^~~~~~~~~~
#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...