| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 971059 | imann | Amusement Park (CEOI19_amusementpark) | C++17 | 647 ms | 4948 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <array>
#include <algorithm>
using ll = long long;
const int MAX_N = 18 + 1;
const int MOD = 998244353;
std::array<std::array<bool, MAX_N>, MAX_N> graph;
std::array<ll, (1 << MAX_N)> dp, sSize;
std::array<bool, (1 << MAX_N)> sInd;
ll solve(int n) {
  sInd.fill(true);
  for (int s = 0; s < (1 << n); ++s) {
    int c = 0;
    for (int i = 0; i < n; ++i) {
      if (s & (1 << i)) {
        for (int j = 0; j < n; ++j) {
          if (s & (1 << j)) {
            if (graph[i][j]) {
              sInd[s] = false;
            }
          }
        }
        c++;
      }
    }
    sSize[s] = c;
  }
  dp[0] = 1;
  for (int s = 1; s < (1 << n); ++s) {
    std::vector<int> ones;
    for (int i = 0; i < n; ++i) {
      if ((1 << i) & s) {
        ones.push_back(i);
      }
    }
    for (int ss = 1; ss < (1 << ones.size()); ++ss) {
      int ssI = 0;
      for (int j = 0; j < ones.size(); ++j) {
        if (ss & (1 << j)) {
          ssI += (1 << ones[j]);
        }
      }
      if (sInd[ssI]) {
        if ((sSize[ssI] % 2) == 1) {
          dp[s] = (dp[s] + dp[s - ssI] + 2 * MOD) % MOD;
        } else {
          dp[s] = (dp[s] - dp[s - ssI] + 2 * MOD) % MOD;
        }
      }
    }
  }
  return dp[(1 << n) - 1];
}
int main() {
  int n, m; std::cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int a, b; std::cin >> a >> b; a--; b--;
    graph[a][b] = true;
    graph[b][a] = true;
  }
  std::cout << (m * solve(n) / 2) % MOD << std::endl;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
