Submission #1001017

#TimeUsernameProblemLanguageResultExecution timeMemory
1001017LucaLucaMTeam Contest (JOI22_team)C++17
8 / 100
2054 ms4696 KiB
#include <iostream> #include <vector> #include <algorithm> #include <cassert> #include <cstring> #warning That's the baby, that's not my baby typedef long long ll; int dumb(int n, std::vector<int> a, std::vector<int> b, std::vector<int> c) { int answer = -1; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { for (int k = 0; k < n; k++) { if (a[i] > a[j] && a[i] > a[k] && b[j] > b[i] && b[j] > b[k] && c[k] > c[i] && c[k] > c[j]) { answer = std::max(answer, a[i] + b[j] + c[k]); } } } } return answer; } int smart(int n, std::vector<int> a, std::vector<int> b, std::vector<int> c) { if (n < 3) { return -1; } int answer = 0; int maxA = *std::max_element(a.begin(), a.end()); int maxB = *std::max_element(b.begin(), b.end()); int maxC = *std::max_element(c.begin(), c.end()); std::vector<int> A, B, C; for (int i = 0; i < n; i++) { int cnt = (a[i] == maxA) + (b[i] == maxB) + (c[i] == maxC); if (cnt <= 1) { A.push_back(a[i]); B.push_back(b[i]); C.push_back(c[i]); } } if ((int) A.size() == n) { return maxA + maxB + maxC; } else { return smart((int) A.size(), A, B, C); } } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); int n; std::cin >> n; std::vector<int> a(n), b(n), c(n); for (int i = 0; i < n; i++) { std::cin >> a[i] >> b[i] >> c[i]; } std::cout << dumb(n, a, b, c); return 0; }

Compilation message (stderr)

team.cpp:6:2: warning: #warning That's the baby, that's not my baby [-Wcpp]
    6 | #warning That's the baby, that's not my baby
      |  ^~~~~~~
team.cpp: In function 'int smart(int, std::vector<int>, std::vector<int>, std::vector<int>)':
team.cpp:28:7: warning: unused variable 'answer' [-Wunused-variable]
   28 |   int answer = 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...