Submission #115543

#TimeUsernameProblemLanguageResultExecution timeMemory
115543WhipppedCreamSeats (IOI18_seats)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "seats.h" #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; #define X first #define Y second #define pb push_back typedef pair<int, int> ii; typedef long long ll; const int maxn = 1e6+5; int r[maxn], c[maxn]; int mnr[maxn]; int mxr[maxn]; int mnc[maxn]; int mxc[maxn]; int n, m; int ans = 0; void give_initial_chart(int H, int W, vector<int> R, vector<int> C) { n = H; m = W; for(int i = 0; i< n*m; i++) { r[i] = R[i]; c[i] = C[i]; } for(int i = 0; i< n*m; i++) { mnr[i] = min(i?mnr[i-1]:1e9, r[i]); mxr[i] = max(i?mxr[i-1]:0, r[i]); mnc[i] = min(i?mnc[i-1]:1e9, c[i]); mxc[i] = max(i?mxc[i-1]:0, c[i]); if((mxr[i]-mnr[i]+1)*(mxc[i]-mnc[i]+1) == i+1) ans++; } } int swap_seats(int a, int b) { if(a> b) swap(a, b); swap(r[a], r[b]); swap(c[a], c[b]); for(int i = a; i< b; i++) { int old = 0; if((mxr[i]-mnr[i]+1)*(mxc[i]-mnc[i]+1) == i+1) old = 1; mnr[i] = min(i?mnr[i-1]:1e9, r[i]); mxr[i] = max(i?mxr[i-1]:0, r[i]); mnc[i] = min(i?mnc[i-1]:1e9, c[i]); mxc[i] = max(i?mxc[i-1]:0, c[i]); int nw = 0; if((mxr[i]-mnr[i]+1)*(mxc[i]-mnc[i]+1) == i+1) nw = 1; ans += nw-old; } return ans; }

Compilation message (stderr)

seats.cpp: In function 'void give_initial_chart(int, int, std::vector<int>, std::vector<int>)':
seats.cpp:32:36: error: no matching function for call to 'min(double, int&)'
   mnr[i] = min(i?mnr[i-1]:1e9, r[i]);
                                    ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from seats.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
seats.cpp:32:36: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   mnr[i] = min(i?mnr[i-1]:1e9, r[i]);
                                    ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from seats.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
seats.cpp:32:36: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   mnr[i] = min(i?mnr[i-1]:1e9, r[i]);
                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from seats.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
seats.cpp:32:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   mnr[i] = min(i?mnr[i-1]:1e9, r[i]);
                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from seats.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
seats.cpp:32:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   mnr[i] = min(i?mnr[i-1]:1e9, r[i]);
                                    ^
seats.cpp:34:36: error: no matching function for call to 'min(double, int&)'
   mnc[i] = min(i?mnc[i-1]:1e9, c[i]);
                                    ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from seats.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
seats.cpp:34:36: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   mnc[i] = min(i?mnc[i-1]:1e9, c[i]);
                                    ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from seats.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
seats.cpp:34:36: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   mnc[i] = min(i?mnc[i-1]:1e9, c[i]);
                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from seats.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
seats.cpp:34:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   mnc[i] = min(i?mnc[i-1]:1e9, c[i]);
                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from seats.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
seats.cpp:34:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   mnc[i] = min(i?mnc[i-1]:1e9, c[i]);
                                    ^
seats.cpp: In function 'int swap_seats(int, int)':
seats.cpp:49:36: error: no matching function for call to 'min(double, int&)'
   mnr[i] = min(i?mnr[i-1]:1e9, r[i]);
                                    ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from seats.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
seats.cpp:49:36: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   mnr[i] = min(i?mnr[i-1]:1e9, r[i]);
                                    ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from seats.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
seats.cpp:49:36: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   mnr[i] = min(i?mnr[i-1]:1e9, r[i]);
                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from seats.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
seats.cpp:49:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   mnr[i] = min(i?mnr[i-1]:1e9, r[i]);
                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from seats.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
seats.cpp:49:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   mnr[i] = min(i?mnr[i-1]:1e9, r[i]);
                                    ^
seats.cpp:51:36: error: no matching function for call to 'min(double, int&)'
   mnc[i] = min(i?mnc[i-1]:1e9, c[i]);
                                    ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from seats.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
seats.cpp:51:36: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   mnc[i] = min(i?mnc[i-1]:1e9, c[i]);
                                    ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from seats.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
seats.cpp:51:36: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   mnc[i] = min(i?mnc[i-1]:1e9, c[i]);
                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from seats.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
seats.cpp:51:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   mnc[i] = min(i?mnc[i-1]:1e9, c[i]);
                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from seats.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
seats.cpp:51:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   mnc[i] = min(i?mnc[i-1]:1e9, c[i]);
                                    ^