Submission #84515

# Submission time Handle Problem Language Result Execution time Memory
84515 2018-11-15T20:51:06 Z memetkagan44 Cipele (COCI18_cipele) C++11
0 / 90
1000 ms 199372 KB
#include<bits/stdc++.h>
using namespace std;
const int N=(int)5e3+5,INF=0x3f3f3f3f;
int dp[N][N],res=INF;
void solve(int x,int y,vector<int>& buyuk,vector<int>& kucuk,int fark,int sinbu,int sinku){
    if(dp[x][y]<fark || sinku-y>sinbu-x)
        return;
    if(!(sinku-y)){
        res=min(res,fark);
        return;
    }
    if(x>=sinbu)
        return;
    if(fark!=-1 && dp[x][y]>fark)
        dp[x][y]=fark;
    solve(x+1,y,buyuk,kucuk,fark,sinbu,sinku);
    solve(x+1,y+1,buyuk,kucuk,max(fark,abs(buyuk[x]-kucuk[y])),sinbu,sinku);
}
int main(){
    memset(dp,0x3f,sizeof dp);
    int n,m,a;
    vector<int> v1,v2;
    scanf("%d %d",&n,&m);
    for(int i=0;i<n;i++){
        scanf("%d",&a);
        v1.push_back(a);
    }
    for(int i=0;i<m;i++){
        scanf("%d",&a);
        v2.push_back(a);
    }
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    if(n>=m)
        solve(0,0,v1,v2,-1,n,m);
    else
        solve(0,0,v2,v1,-1,m,n);
    printf("%d\n",res);
    return 0;
}

Compilation message

cipele.cpp: In function 'int main()':
cipele.cpp:23:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~~
cipele.cpp:25:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&a);
         ~~~~~^~~~~~~~~
cipele.cpp:29:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&a);
         ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 111 ms 99564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 132 ms 99572 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 141 ms 99572 KB Output is correct
2 Execution timed out 1079 ms 99572 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 99572 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 99572 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 99572 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 99572 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 240 ms 199232 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 283 ms 199372 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 280 ms 199372 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -