Submission #529652

#TimeUsernameProblemLanguageResultExecution timeMemory
529652topovikHiperkocka (COCI21_hiperkocka)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define pb push_back #define f first #define s second using namespace std; typedef long long ll; typedef long double ld; const ll oo = 1e18 + 7; const ll N = 5e5 + 10; const ll M = 1000; const ll M1 = 1e6; int n; map <int, bool> mrk[N]; vector <int> a[N]; vector <int> ans; vector <vector <int> > ans1; vector <pair<int, int> > vc; bool g = 1; bool check(int x) { for (int i = 0; i < n; i++) if (x == (1 << i)) return 1; return 0; } void Rec(int x, int y, int prv) { ans1.back()[y] = x; for (auto i : a[y]) if (i != prv) { int j; for (j = 0; j < (1 << n); (j == 0 ? j++ : j <<= 1)) if (!mrk[min(x, j ^ x)][max(j ^ x, x)] && (j ^ x) != x) { mrk[min(x, j ^ x)][max(j ^ x, x)] = 1; vc.pb({min(x, j ^ x), max(j ^ x, x)}); Rec(j ^ x, i, y); break; } g &= (j != (1 << n)); } } int main() { ios_base::sync_with_stdio(0); iostream::sync_with_stdio(0); cin.tie(0); cout.tie(0); srand(time(NULL)); cin >> n; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; a[x].pb(y); a[y].pb(x); } while (1) { bool g1 = 0; for (int i = 0; i <= n; i++) { ans1.pb({}); ans1.back().resize(n + 1); vc.clear(); g = 1; Rec(i, 0, 0); if (g) { g1 = 1; break; } ans1.pop_back(); for (auto j : vc) mrk[j.f][j.s] = 0; } if (!g1) break; } int k = ans1.size(); for (int x = 0; x < min((1 << n), M); x++) { for (int ps = 0; ps < k; ps++) { bool g = 1; for (int i = 0; i <= n; i++) for (auto j : a[i]) g &= !mrk[min(ans1[ps][i] ^ x, ans1[ps][j] ^ x)][max(ans1[ps][i] ^ x, ans1[ps][j] ^ x)]; if (g) { ans1.pb(ans1[ps]); for (int i = 0; i <= n; i++) ans1.back()[i] ^= x; for (int i = 0; i <= n; i++) for (auto j : a[i]) mrk[min(ans1.back()[i], ans1.back()[j])][max(ans1.back()[i], ans1.back()[j])] = 1; } } } cout << ans1.size() << endl; for (auto i : ans1) { for (auto j : i) cout << j << " "; cout << endl; } } /* 5 3 2 1 1 2 2 3 2 3 3 4 4 5 4 1 1 2 2 3 3 4 4 5 */

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:88:40: error: no matching function for call to 'min(int, const ll&)'
   88 |     for (int x = 0; x < min((1 << n), M); x++)
      |                                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from Main.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
Main.cpp:88:40: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   88 |     for (int x = 0; x < min((1 << n), M); x++)
      |                                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from Main.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
Main.cpp:88:40: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   88 |     for (int x = 0; x < min((1 << n), M); x++)
      |                                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Main.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
Main.cpp:88:40: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   88 |     for (int x = 0; x < min((1 << n), M); x++)
      |                                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Main.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
Main.cpp:88:40: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   88 |     for (int x = 0; x < min((1 << n), M); x++)
      |                                        ^