# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1065392 |
2024-08-19T06:57:04 Z |
EkinOnal |
Cipele (COCI18_cipele) |
C++17 |
|
25 ms |
3416 KB |
//#pragma GCC optimize("O3,unroll-loops,Ofast")
//#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#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;
#define MAX 200007
#define pb push_back
#define mp make_pair
#define int long long
#define f first
#define s second
#define vi vector<int>
#define pii pair<int,int>
#define si set<int>
#define vpii vector<pair<int,int>>
const int mod = 1e9+7;
const int INF = 1e18;
// myMap.begin()->first : key
// myMap.begin()->second : value
int epow(int a,int b){int ans=1;while(b){if(b&1) ans*=a;a*=a;;b>>=1;}return ans;}
int gcd(int a,int b) {if(a<b)swap(a,b);while(b){int tmp=b;b=a%b;a=tmp;}return a;}
int mul(int a,int b){return ((a%mod)*(b%mod))%mod;}
int sum(int a,int b){return ((a%mod)+(b%mod))%mod;}
//typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
void solve(){
int n,m; cin>>n>>m;
vi a(n),b(m);
for(int i=0;i<n;i++) cin>>a[i]; sort(a.begin(),a.end());
for(int i=0;i<m;i++) cin>>b[i]; sort(b.begin(),b.end());
if(n<m) {swap(a,b);swap(n,m);}
int ans=0;
/* for(int i=0;i<m;i++){
ans = max(ans,abs(b[i]-a[i+n-m]));
} */
int idx=0;
while(idx<n-m && a[idx]<b[0]) idx++;
for(int i=idx;i<n;i++){
ans = max(ans,abs(b[i-idx]-a[i]));
}
cout<<ans<<endl;
return;
}
int32_t main() {
// freopen("hayfeast.in", "r", stdin);
// freopen("hayfeast.out", "w", stdout);
ios_base::sync_with_stdio(0);cin.tie(0);
int t=1;
// cin >> t;
while (t--) solve();
return 0;
}
Compilation message
cipele.cpp: In function 'void solve()':
cipele.cpp:35:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
35 | for(int i=0;i<n;i++) cin>>a[i]; sort(a.begin(),a.end());
| ^~~
cipele.cpp:35:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
35 | for(int i=0;i<n;i++) cin>>a[i]; sort(a.begin(),a.end());
| ^~~~
cipele.cpp:36:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
36 | for(int i=0;i<m;i++) cin>>b[i]; sort(b.begin(),b.end());
| ^~~
cipele.cpp:36:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
36 | for(int i=0;i<m;i++) cin>>b[i]; sort(b.begin(),b.end());
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
1884 KB |
Output is correct |
2 |
Correct |
25 ms |
2044 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
2036 KB |
Output is correct |
2 |
Correct |
25 ms |
1884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
21 ms |
3028 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
24 ms |
3416 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
21 ms |
2900 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |