Submission #472288

#TimeUsernameProblemLanguageResultExecution timeMemory
472288Mr_PhCipele (COCI18_cipele)C++14
Compilation error
0 ms0 KiB
///made by : Mr_Ph :D #include<bits/stdc++.h> #include<unordered_map> typedef long long ll; typedef long long int lli; typedef unsigned long long ull; using namespace std; const double PI=acos(-1.0); const ll mod=(ll)1e9+7; //int a1[4] = {0, 0, 1, -1}; //int b1[4] = {1, -1, 0, 0}; ///the defines :) #define endl '\n' #define vi vector<int> #define vll vector<ll> #define lower(s) transform(s.begin(),s.end(),s.begin(),::tolower) #define upper(s) transform(s.begin(),s.end(),s.begin(),::toupper) #define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i]; #define all(arr) arr.begin(),arr.end() #define allr(arr) arr.rbegin(),arr.rend() #define sz size() ///the end of the defines ;) void solve() { int n,m; cin>>n>>m; deque<int>arr(n); deque<int>brr(m); ent(arr); ent(brr); map<int,int>mp; sort(all(arr)); sort(all(brr)); int mxdiff=0,ans=0; if(n==m) { for(int i=0;i<n;i++) mxdiff=max(abs(arr[i]-brr[i])); cout<<mxdiff<<endl; } else if(n>m) { for(int i=0; i<m; i++) { int mndiff=INT_MAX; for(int k=i; k<n; k++) if(!mp[k]) mndiff=min(mndiff,abs(brr[i]-arr[k])); for(int k=i; k<n; k++) { if(abs(arr[k]-brr[i])==mndiff&&!mp[k]) { mp[k]++; break; } } ans=max(ans,mndiff); } } else { for(int i=0; i<n; i++) { int mndiff=INT_MAX; for(int k=i; k<m; k++) if(!mp[k]) mndiff=min(mndiff,abs(arr[i]-brr[k])); for(int k=i; k<n; k++) { if(abs(brr[k]-arr[i])==mndiff&&!mp[k]) { mp[k]++; break; } } ans=max(ans,mndiff); } } cout<<ans<<endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); //freopen("window.in","r",stdin); //freopen("output.txt","w",stdout); int t=1;//int st; //cin>>t;//cin>>st; while(t--) solve(); }

Compilation message (stderr)

cipele.cpp: In function 'void solve()':
cipele.cpp:18:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 | #define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
      |                              ~^~~~~~~~~~~
cipele.cpp:29:5: note: in expansion of macro 'ent'
   29 |     ent(arr);
      |     ^~~
cipele.cpp:18:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 | #define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
      |                              ~^~~~~~~~~~~
cipele.cpp:30:5: note: in expansion of macro 'ent'
   30 |     ent(brr);
      |     ^~~
cipele.cpp:38:42: error: no matching function for call to 'max(int)'
   38 |             mxdiff=max(abs(arr[i]-brr[i]));
      |                                          ^
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 cipele.cpp:2:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
cipele.cpp:38:42: note:   candidate expects 2 arguments, 1 provided
   38 |             mxdiff=max(abs(arr[i]-brr[i]));
      |                                          ^
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 cipele.cpp:2:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
cipele.cpp:38:42: note:   candidate expects 3 arguments, 1 provided
   38 |             mxdiff=max(abs(arr[i]-brr[i]));
      |                                          ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from cipele.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
cipele.cpp:38:42: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   38 |             mxdiff=max(abs(arr[i]-brr[i]));
      |                                          ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from cipele.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
cipele.cpp:38:42: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   38 |             mxdiff=max(abs(arr[i]-brr[i]));
      |                                          ^