# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
99723 | 2019-03-06T09:11:22 Z | Sa1loum | Cipele (COCI18_cipele) | C++14 | 276 ms | 201620 KB |
#include <bits/stdc++.h> using namespace std; #define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define mem(a,b) memset(a, b, sizeof(a)) #define F first #define S second #define Si size #define pb(x) push_back(x) typedef double D; typedef long long ll; typedef long double ld; const int MOD=(int)1e9+7,MAX=(int)1e5+10; int n,m,a[MAX],b[MAX],dp[5050][5050]; int DP(int i,int j) { if (dp[i][j]!=-1) return dp[i][j]; if (i==n && j==m) return dp[i][j]=INT_MIN; if (j==m) return dp[i][j]=INT_MAX; if (i==n) return dp[i][j]=INT_MIN; return dp[i][j]=min(DP(i,j+1),max(DP(i+1,j+1),abs(a[i]-b[j]))); } int main() { for (int i=0;i<5050;i++) { for (int j=0;j<5050;j++) { dp[i][j]=-1; } } scanf("%d%d",&n,&m); if (n<m) { for (int i=0;i<n;i++) { scanf("%d",&a[i]); } for (int i=0;i<m;i++) { scanf("%d",&b[i]); } } else { for (int i=0;i<n;i++) { scanf("%d",&b[i]); } for (int i=0;i<m;i++) { scanf("%d",&a[i]); } swap(n,m); } sort(a,a+n); sort(b,b+m); if (n==m) { int mx=-1; for (int i=0;i<n;i++) { int o=fabs(a[i]-b[i]); mx=max(mx,o); } cout<<mx<<endl; return 0; } int mn=INT_MAX; for (int i=n-1;i<m;i++) { mn=min(mn,DP(n-1,i)); } cout<<mn; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 127 ms | 100984 KB | Output is correct |
2 | Correct | 135 ms | 101112 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 134 ms | 101036 KB | Output is correct |
2 | Correct | 135 ms | 101060 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 88 ms | 100152 KB | Output is correct |
2 | Incorrect | 91 ms | 100280 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 87 ms | 100412 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 104 ms | 100180 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 94 ms | 100216 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 87 ms | 100224 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 263 ms | 201464 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 236 ms | 201620 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 276 ms | 201400 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |