Submission #1001017

# Submission time Handle Problem Language Result Execution time Memory
1001017 2024-06-18T12:50:34 Z LucaLucaM Team Contest (JOI22_team) C++17
8 / 100
2000 ms 4696 KB
#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

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 time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 452 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 36 ms 348 KB Output is correct
15 Correct 15 ms 348 KB Output is correct
16 Correct 28 ms 472 KB Output is correct
17 Correct 27 ms 344 KB Output is correct
18 Correct 28 ms 348 KB Output is correct
19 Correct 33 ms 348 KB Output is correct
20 Correct 26 ms 348 KB Output is correct
21 Correct 20 ms 472 KB Output is correct
22 Correct 22 ms 472 KB Output is correct
23 Correct 19 ms 344 KB Output is correct
24 Correct 22 ms 344 KB Output is correct
25 Correct 23 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 452 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 36 ms 348 KB Output is correct
15 Correct 15 ms 348 KB Output is correct
16 Correct 28 ms 472 KB Output is correct
17 Correct 27 ms 344 KB Output is correct
18 Correct 28 ms 348 KB Output is correct
19 Correct 33 ms 348 KB Output is correct
20 Correct 26 ms 348 KB Output is correct
21 Correct 20 ms 472 KB Output is correct
22 Correct 22 ms 472 KB Output is correct
23 Correct 19 ms 344 KB Output is correct
24 Correct 22 ms 344 KB Output is correct
25 Correct 23 ms 344 KB Output is correct
26 Execution timed out 2054 ms 600 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 456 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Execution timed out 2017 ms 4696 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 456 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Execution timed out 2017 ms 4696 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 456 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Execution timed out 2017 ms 4696 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 456 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Execution timed out 2017 ms 4696 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 452 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 36 ms 348 KB Output is correct
15 Correct 15 ms 348 KB Output is correct
16 Correct 28 ms 472 KB Output is correct
17 Correct 27 ms 344 KB Output is correct
18 Correct 28 ms 348 KB Output is correct
19 Correct 33 ms 348 KB Output is correct
20 Correct 26 ms 348 KB Output is correct
21 Correct 20 ms 472 KB Output is correct
22 Correct 22 ms 472 KB Output is correct
23 Correct 19 ms 344 KB Output is correct
24 Correct 22 ms 344 KB Output is correct
25 Correct 23 ms 344 KB Output is correct
26 Execution timed out 2054 ms 600 KB Time limit exceeded
27 Halted 0 ms 0 KB -