Submission #208147

# Submission time Handle Problem Language Result Execution time Memory
208147 2020-03-10T06:02:57 Z E869120 Amusement Park (CEOI19_amusementpark) C++14
0 / 100
5 ms 376 KB
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#pragma warning (disable: 4996)

long long mod = 998244353;
int N, M, A[1009], B[1009];
int idx[11];

int main() {
	cin >> N >> M;
	for (int i = 1; i <= M; i++) cin >> A[i] >> B[i];
	for (int i = 1; i <= N; i++) idx[i] = i;

	vector<long long> vec;
	do {
		long long ret = 0;
		for (int i = 1; i <= M; i++) {
			if (idx[A[i]] < idx[B[i]]) ret += (1LL << (i - 1));
		}
		vec.push_back(ret);
	} while (next_permutation(idx + 1, idx + N + 1));

	sort(vec.begin(), vec.end());
	vec.erase(unique(vec.begin(), vec.end()), vec.end());
	long long ans = 1LL * N * vec.size();
	if (ans % 2LL == 1LL) ans += mod; ans /= 2LL;
	cout << ans << endl;
	return 0;
}

Compilation message

amusementpark.cpp:5:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning (disable: 4996)
 
amusementpark.cpp: In function 'int main()':
amusementpark.cpp:28:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
  if (ans % 2LL == 1LL) ans += mod; ans /= 2LL;
  ^~
amusementpark.cpp:28:36: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  if (ans % 2LL == 1LL) ans += mod; ans /= 2LL;
                                    ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -