Submission #472278

#TimeUsernameProblemLanguageResultExecution timeMemory
472278_L__Cipele (COCI18_cipele)C++17
18 / 90
1091 ms1868 KiB
// This code is written by _L__ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template<class T> using ordered_set = tree<T, null_type , less<T> , rb_tree_tag , tree_order_statistics_node_update>; #define endl '\n' #define F_word ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); typedef long long ll; typedef long double ld; const ll mod = 1e9+7, N = 1e5+300, INF = 1e18; const ld E = 1e-6; int main(void){ F_word; int n, m; cin >> n >> m; vector<ll> l(n), r(m); for(int i = 0; i < n; ++i) cin >> l[i]; for(int i =0 ; i < m; ++i) cin >> r[i]; sort(l.begin(), l.end()); sort(r.begin(), r.end()); if(n <= m){ ll ans = 0; for(int i = 0; i < n; ++i){ ll idx = 0, b = INT_MAX; for(int j = 0; j < r.size(); ++j){ if(abs(r[j]-l[i]) <= b){ b = abs(r[j]-l[i]); idx = j; } } r.erase(r.begin()+idx); ans = max(ans, b); } cout << ans << endl; } else { ll ans = 0; for(int i = 0; i < m; ++i){ ll idx = 0, b = INT_MAX; for(int j =0;j < l.size(); ++j){ if(abs(l[j]-r[i]) <= b){ idx = j; b = abs(r[i]-l[j]); } } l.erase(l.begin()+idx); ans = max(ans, b); } cout << ans << endl; } }

Compilation message (stderr)

cipele.cpp: In function 'int main()':
cipele.cpp:25:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |             for(int j = 0; j < r.size(); ++j){
      |                            ~~^~~~~~~~~~
cipele.cpp:39:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |             for(int j =0;j < l.size(); ++j){
      |                          ~~^~~~~~~~~~
#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...
#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...