답안 #983140

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
983140 2024-05-15T08:40:36 Z duckindog Amusement Park (CEOI19_amusementpark) C++17
0 / 100
1 ms 456 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 18 + 10,
          M = 998'244'353;
int n, m;
int a[N], b[N];

int32_t main() { 
  cin.tie(0)->sync_with_stdio(0);

  cin >> n >> m;
  for (int i = 1; i <= m; ++i) cin >> a[i] >> b[i];

  long long answer = 0;
  vector<int> vt(n); iota(vt.begin(), vt.end(), 1);

  do { 
    vector<int> p(n);
    for (int i = 0; i < n; ++i) p[vt[i]] = i;
    for (int i = 1; i <= m; ++i) answer += p[a[i]] > p[b[i]];
  } while (next_permutation(vt.begin(), vt.end()));

  cout << answer % M << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 456 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Incorrect 1 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 456 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Incorrect 1 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 456 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Incorrect 1 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 456 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Incorrect 1 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 456 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Incorrect 1 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -