/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 482ms 12.434 MiB
#2 Accepted 482ms 12.387 MiB
#3 Accepted 482ms 12.43 MiB
#4 Wrong Answer 482ms 12.258 MiB
#5 Wrong Answer 483ms 12.305 MiB
#6 Wrong Answer 491ms 12.379 MiB
#7 Accepted 481ms 12.379 MiB
#8 Accepted 487ms 12.25 MiB
#9 Accepted 485ms 12.434 MiB
#10 Accepted 482ms 12.457 MiB
#11 Accepted 481ms 12.383 MiB
#12 Wrong Answer 481ms 12.434 MiB
#13 Wrong Answer 482ms 12.219 MiB
#14 Accepted 480ms 12.32 MiB
#15 Accepted 486ms 12.273 MiB
#16 Wrong Answer 484ms 12.426 MiB
#17 Accepted 482ms 12.395 MiB
#18 Wrong Answer 493ms 12.426 MiB
#19 Wrong Answer 483ms 12.352 MiB
#20 Wrong Answer 485ms 12.379 MiB
#21 Wrong Answer 484ms 12.199 MiB
#22 Wrong Answer 481ms 12.289 MiB
#23 Wrong Answer 481ms 12.434 MiB
#24 Accepted 487ms 12.203 MiB
#25 Wrong Answer 488ms 12.672 MiB
#26 Wrong Answer 482ms 12.246 MiB
#27 Accepted 482ms 12.23 MiB
#28 Wrong Answer 492ms 12.227 MiB
#29 Accepted 483ms 12.504 MiB
#30 Wrong Answer 481ms 12.609 MiB
#31 Wrong Answer 482ms 12.273 MiB
#32 Accepted 488ms 12.434 MiB
#33 Wrong Answer 482ms 12.547 MiB
#34 Wrong Answer 483ms 12.324 MiB
#35 Accepted 509ms 12.211 MiB
#36 Wrong Answer 485ms 12.547 MiB
#37 Wrong Answer 484ms 12.34 MiB
#38 Wrong Answer 481ms 12.41 MiB
#39 Wrong Answer 482ms 12.5 MiB

Code


#include <set>
#include <array>
#include <vector>
#include <iostream>

using namespace std;

array<int, 4> type;
set<array<int, 4>> S;
vector g(3, vector<bool> (3));
vector<pair<int, vector<pair<int, int>>>> can;

void dfs(int L = 0) {
  if (L >= (int) can.size()) {
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        type[0] += !g[i][j];
      }
    }
    S.insert(type);
    type[0] = 0;
    return;
  }
  dfs(L + 1);
  const auto& [t, v] = can[L];
  bool foo = 1;
  for (auto [i, j] : v) {
    foo &= !g[i][j];
  }
  if (foo) {
    type[t] += 1;
    for (auto [i, j] : v) {
      g[i][j] = 1;
    }
    dfs(L + 1);
    type[t] -= 1;
    for (auto [i, j] : v) {
      g[i][j] = 0;
    }
  }
}

const int N = 41;
int f[N + 1][N + 1][N + 1][N + 1];

inline void Max(int& a, int b) {
  a = max(a, b);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 2; j++) {
      {
        vector<pair<int, int>> a;
        a.emplace_back(i, j);
        a.emplace_back(i, j + 1);
        can.emplace_back(1, a);
      }
      {
        swap(i, j);
        vector<pair<int, int>> a;
        a.emplace_back(i, j);
        a.emplace_back(i + 1, j);
        can.emplace_back(1, a);
        swap(i, j);
      }
    }
    {
      vector<pair<int, int>> a;
      a.emplace_back(i, 0);
      a.emplace_back(i, 1);
      a.emplace_back(i, 2);
      can.emplace_back(2, a);
    }
    {
      vector<pair<int, int>> a;
      a.emplace_back(0, i);
      a.emplace_back(1, i);
      a.emplace_back(2, i);
      can.emplace_back(2, a);
    }
  }
  vector<pair<int, int>> moves = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}, {1, 0}};
  auto inside = [&](int i, int j) {
    return min(i, j) >= 0 && max(i, j) < 3;
  };
  for (int d = 0; d < 4; d++) {
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        int x = i + moves[d].first;
        int y = j + moves[d].second;
        int u = i + moves[d + 1].first;
        int v = i + moves[d + 1].second;
        if (inside(x, y) && inside(u, v)) {
          vector<pair<int, int>> a;
          a.emplace_back(i, j);
          a.emplace_back(x, y);
          a.emplace_back(u, v);
          can.emplace_back(3, a);
        }
      }
    }
  }
  dfs();
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      for (int k = 0; k < N; k++) {
        for (int l = 0; l < N; l++) {
          Max(f[i + 1][j][k][l], f[i][j][k][l]);
          Max(f[i][j + 1][k][l], f[i][j][k][l]);
          Max(f[i][j][k + 1][l], f[i][j][k][l]);
          Max(f[i][j][k][l + 1], f[i][j][k][l]);
          for (auto [a, b, c, d] : S) {
            if (i + a <= N && j + b <= N && k + c <= N && l + d <= N) {
              Max(f[i + a][j + b][k + c][l + d], f[i][j][k][l] + 1);
            }
          }
        }
      }
    }
  }
  int t;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << "Case " << i << ": " << f[a][b][c][d] << '\n';
  }
  return 0;
}
  

Information

Submit By
Type
Submission
Problem
P1014 FIFA World Cup 2022 Again!
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-07 00:09:06
Judged At
2024-05-07 00:09:06
Judged By
Score
16
Total Time
509ms
Peak Memory
12.672 MiB