QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#497467#4912. WereYouLastbykem100 ✓5451ms4936kbC++201.2kb2024-07-29 09:20:312024-07-29 09:20:31

Judging History

你现在查看的是最新测评结果

  • [2024-07-29 09:20:31]
  • 评测
  • 测评结果:100
  • 用时:5451ms
  • 内存:4936kb
  • [2024-07-29 09:20:31]
  • 提交

answer

bool query(int);
void modify(int, bool);

const int kT[3][42][2] = {
  {{}, {2, 13}, {3, 8}, {4, 6}, {5}, {}, {0, 7}, {}, {9, 11}, {0, 10}, {}, {12}, {}, {14, 19}, {15, 17}, {0, 16}, {}, {18}, {}, {20, 22}, {21}, {}, {0, 23}, {}},
  {{}, {2, 17}, {3, 10}, {4, 8}, {5}, {6, 7}, {}, {}, {0, 9}, {}, {11}, {12, 14}, {0, 13}, {}, {15, 16}, {}, {}, {18, 25}, {19}, {20, 22}, {0, 21}, {}, {23, 24}, {}, {}, {26, 30}, {27}, {28, 29}, {}, {}, {0, 31}, {}},
  {{}, {2, 23}, {3, 13}, {4, 8}, {5, 7}, {6}, {}, {}, {9, 12}, {10, 11}, {}, {}, {}, {14, 21}, {15, 18}, {16, 17}, {}, {}, {19, 20}, {}, {}, {22}, {}, {24, 33}, {25, 29}, {26, 28}, {27}, {}, {}, {30}, {31, 32}, {}, {}, {34, 38}, {35}, {36, 37}, {}, {}, {39, 41}, {40}, {}, {}}
};

bool count(int o, int x) {
  if (!x) {
    return 1;
  }
  if (query(x)) {
    modify(x, 0);
    return count(o, kT[o][x][1]);
  }
  modify(x, count(o, kT[o][x][0]));
  return 0;
}
bool WereYouLast(int n, int m) {
  if (n == (1 << 10)) {
    int i = 1;
    for (; i <= 10 && query(i); modify(i++, 0)) {
    }
    if (i == 11) {
      return 1;
    }
    modify(i, 1);
    return 0;
  }
  return count(n == (1 << 26) ? 2 : n == (1 << 20), 1);
}

详细

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 0ms
memory: 3896kb

input:

1024 10

output:

12345876 10 10

result:

ok Correct Answer.
C1 = 10.
C2 = 10.

Subtask #2:

score: 20
Accepted

Test #2:

score: 20
Accepted
time: 6ms
memory: 4928kb

input:

65536 100000

output:

12345876 5 5

result:

ok Correct Answer.
C1 = 5.
C2 = 5.

Subtask #3:

score: 30
Accepted

Test #3:

score: 30
Accepted
time: 88ms
memory: 4924kb

input:

1048576 100000

output:

12345876 6 6

result:

ok Correct Answer.
C1 = 6.
C2 = 6.

Subtask #4:

score: 40
Accepted

Test #4:

score: 40
Accepted
time: 5451ms
memory: 4936kb

input:

67108864 100000

output:

12345876 6 6

result:

ok Correct Answer.
C1 = 6.
C2 = 6.