# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
472260 |
2021-09-13T10:33:27 Z |
Mr_Ph |
Cipele (COCI18_cipele) |
C++14 |
|
1000 ms |
1112 KB |
///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);
sort(all(arr));
sort(all(brr));
int mxdiff=0,ans=INT_MAX;
if(n>=m)
{
while(arr.sz>=m)
{
mxdiff=0;
for(int i=0;i<m;i++)
mxdiff=max(mxdiff,abs(arr[i]-brr[i]));
ans=min(mxdiff,ans);
arr.pop_front();
}
}
else
{
while(brr.sz>=n)
{
mxdiff=0;
for(int i=0;i<n;i++)
mxdiff=max(mxdiff,abs(arr[i]-brr[i]));
ans=min(mxdiff,ans);
brr.pop_front();
}
}
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
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:36:21: warning: comparison of integer expressions of different signedness: 'std::deque<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
36 | while(arr.sz>=m)
| ~~~~~~^~~
cipele.cpp:47:21: warning: comparison of integer expressions of different signedness: 'std::deque<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
47 | while(brr.sz>=n)
| ~~~~~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
1100 KB |
Output is correct |
2 |
Correct |
48 ms |
1108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
1100 KB |
Output is correct |
2 |
Correct |
46 ms |
1112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
3 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
328 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
844 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1068 ms |
972 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1048 ms |
844 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |