Submission #397756

#TimeUsernameProblemLanguageResultExecution timeMemory
397756KoDAlternating Current (BOI18_alternating)C++17
13 / 100
51 ms1072 KiB
#include <bits/stdc++.h> using ll = long long; template <class T> using Vec = std::vector<T>; int main() { int N, M; std::cin >> N >> M; Vec<int> A(M), B(M); for (int i = 0; i < M; ++i) { std::cin >> A[i] >> B[i]; A[i] -= 1; B[i] -= 1; } if (N <= 15 and M <= 15) { for (int set = 0; set < (1 << M); ++set) { bool ok = true; for (int i = 0; i < N; ++i) { bool f = false, g = false; for (int j = 0; j < M; ++j) { if ((A[j] <= B[j] and A[j] <= i and i <= B[j]) or (A[j] > B[j] and (A[j] <= i or i <= B[j]))) { ((set >> j & 1) ? f : g) = true; } } if (!f or !g) { ok = false; break; } } if (ok) { for (int j = 0; j < M; ++j) { std::cout << (set >> j & 1); } std::cout << '\n'; return 0; } } std::cout << "impossible\n"; return 0; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...