/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 297ms 11.289 MiB
#2 Wrong Answer 313ms 11.117 MiB
#3 Wrong Answer 268ms 11.34 MiB
#4 Wrong Answer 296ms 11.102 MiB
#5 Wrong Answer 306ms 11.23 MiB
#6 Wrong Answer 298ms 11.555 MiB
#7 Accepted 297ms 11.348 MiB
#8 Accepted 272ms 11.176 MiB
#9 Accepted 298ms 11.242 MiB
#10 Accepted 301ms 11.113 MiB
#11 Accepted 298ms 11.258 MiB
#12 Wrong Answer 297ms 11.121 MiB
#13 Wrong Answer 297ms 11.199 MiB
#14 Accepted 305ms 11.246 MiB
#15 Accepted 297ms 11.195 MiB
#16 Wrong Answer 298ms 11.176 MiB
#17 Accepted 297ms 11.324 MiB
#18 Wrong Answer 299ms 11.551 MiB
#19 Wrong Answer 303ms 11.25 MiB
#20 Wrong Answer 313ms 11.324 MiB
#21 Wrong Answer 299ms 11.363 MiB
#22 Wrong Answer 299ms 11.188 MiB
#23 Wrong Answer 308ms 11.215 MiB
#24 Accepted 301ms 11.184 MiB
#25 Wrong Answer 298ms 11.184 MiB
#26 Wrong Answer 299ms 11.215 MiB
#27 Accepted 298ms 11.289 MiB
#28 Wrong Answer 299ms 11.273 MiB
#29 Accepted 297ms 11.344 MiB
#30 Wrong Answer 303ms 11.266 MiB
#31 Wrong Answer 299ms 11.129 MiB
#32 Wrong Answer 299ms 11.324 MiB
#33 Wrong Answer 301ms 11.312 MiB
#34 Wrong Answer 302ms 11.301 MiB
#35 Accepted 298ms 11.098 MiB
#36 Wrong Answer 299ms 11.23 MiB
#37 Wrong Answer 297ms 11.262 MiB
#38 Wrong Answer 308ms 11.246 MiB
#39 Wrong Answer 306ms 11.094 MiB

Code


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

using namespace std;

char g[3][3];
array<int, 4> type;
set<array<int, 4>> S;

void dfs(int L = 0) {
  if (L < 4) {
    dfs(L + 1);
    int x = 1, y = 1;
    if (L < 2) {
      y += L;
    } else {
      x += 1;
      y += L - 2;
    }
    if (!g[x][y] && !g[x - 1][y] && !g[x][y - 1]) {
      type[3] += 1;
      g[x][y] = 1;
      g[x - 1][y] = 1;
      g[x][y - 1] = 1;
      dfs(L + 1);
      type[3] -= 1;
      g[x][y] = 0;
      g[x - 1][y] = 0;
      g[x][y - 1] = 0;
    }
    return;
  }
  if (L < 10) {
    dfs(L + 1);
    int x = 0, y = 0;
    if (L < 7) {
      y = L - 4;
    } else {
      x = 1;
      y = L - 7;
    }
    if (!g[x][y] && !g[x + 1][y]) {
      type[1] += 1;
      g[x][y] = 1;
      g[x + 1][y] = 1;
      dfs(L + 1);
      type[1] -= 1;
      g[x][y] = 0;
      g[x + 1][y] = 0;
    }
    return;
  }
  if (L < 16) {
    dfs(L + 1);
    int x = 0, y = 0;
    if (L < 13) {
      x = L - 10;
    } else {
      y = 1;
      x = L - 13;
    }
    if (!g[x][y] && !g[x][y + 1]) {
      type[1] += 1;
      g[x][y] = 1;
      g[x][y + 1] = 1;
      dfs(L + 1);
      type[1] -= 1;
      g[x][y] = 0;
      g[x][y + 1] = 0;
    }
    return;
  }
  if (L < 19) {
    dfs(L + 1);
    int x = 0, y = L - 16;
    if (!g[x][y] && !g[x + 1][y] && !g[x + 2][y]) {
      type[2] += 1;
      g[x][y] = 1;
      g[x + 1][y] = 1;
      g[x + 2][y] = 1;
      dfs(L + 1);
      type[2] -= 1;
      g[x][y] = 0;
      g[x + 1][y] = 0;
      g[x + 2][y] = 0;
    }
    return;
  }
  if (L < 22) {
    dfs(L + 1);
    int x = L - 19, y = 0;
    if (!g[x][y] && !g[x][y + 1] && !g[x][y + 2]) {
      type[2] += 1;
      g[x][y] = 1;
      g[x][y + 1] = 1;
      g[x][y + 2] = 1;
      dfs(L + 1);
      type[2] -= 1;
      g[x][y] = 0;
      g[x][y + 1] = 0;
      g[x][y + 2] = 0;
    }
    return;
  }
  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;
}

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

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  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++) {
          for (auto [a, b, c, d] : S) {
            if (a <= i && b <= j && c <= k && d <= l) {
              Max(f[i][j][k][l], f[i - a][j - b][k - c][l - d] + 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-06 22:58:47
Judged At
2024-05-06 22:58:47
Judged By
Score
13
Total Time
313ms
Peak Memory
11.555 MiB