/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 264ms 12.434 MiB
#2 Wrong Answer 264ms 12.203 MiB
#3 Accepted 263ms 12.348 MiB
#4 Accepted 265ms 12.242 MiB
#5 Accepted 292ms 12.344 MiB
#6 Accepted 261ms 12.398 MiB
#7 Accepted 264ms 12.656 MiB
#8 Accepted 261ms 12.277 MiB
#9 Accepted 264ms 12.348 MiB
#10 Accepted 261ms 12.332 MiB
#11 Accepted 272ms 12.426 MiB
#12 Accepted 262ms 12.391 MiB
#13 Wrong Answer 261ms 12.391 MiB
#14 Accepted 263ms 12.234 MiB
#15 Accepted 263ms 12.281 MiB
#16 Accepted 264ms 12.336 MiB
#17 Accepted 293ms 12.395 MiB
#18 Accepted 261ms 12.324 MiB
#19 Accepted 263ms 12.332 MiB
#20 Accepted 262ms 12.34 MiB
#21 Wrong Answer 263ms 12.441 MiB
#22 Wrong Answer 261ms 12.422 MiB
#23 Wrong Answer 271ms 12.391 MiB
#24 Accepted 266ms 12.289 MiB
#25 Accepted 264ms 12.215 MiB
#26 Accepted 264ms 12.527 MiB
#27 Accepted 264ms 12.227 MiB
#28 Accepted 286ms 12.434 MiB
#29 Accepted 264ms 12.414 MiB
#30 Accepted 266ms 12.434 MiB
#31 Accepted 265ms 12.387 MiB
#32 Wrong Answer 262ms 12.195 MiB
#33 Accepted 264ms 12.262 MiB
#34 Accepted 264ms 12.359 MiB
#35 Accepted 262ms 12.379 MiB
#36 Accepted 265ms 12.406 MiB
#37 Wrong Answer 264ms 12.328 MiB
#38 Accepted 264ms 12.375 MiB
#39 Accepted 262ms 12.281 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()) {
    int ok = 1;
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        ok &= g[i][j];
      }
    }
    if (ok) S.insert(type);
    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 < 3; j++) {
      can.emplace_back(0, vector{make_pair(i, j)} );
    }
  }
  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 = j + 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 01:42:41
Judged At
2024-05-07 01:42:41
Judged By
Score
93
Total Time
293ms
Peak Memory
12.656 MiB