답안 #40625

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
40625 2018-02-06T00:27:33 Z Hassoony 학생 (COCI14_studentsko) C++14
0 / 100
1 ms 416 KB
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
typedef unsigned long long ll;
typedef double D;
const ll inf=(1ll<<61);
const ll mod=1e9+7;
const int MX=5009;
int n,k,a[MX],dp[MX][MX];
int DP(int x,int y){
    if(x==n)return 0;
    int &ret=dp[x][y];if(ret!=-1)return ret;
    ret=DP(x+1,y);
    if(a[x]>=y)ret=max(ret,DP(x+1,a[x])+1);
    return ret;
}
map<int,int>hashy;
int b[MX];
int main(){
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++)scanf("%d",&a[i]),b[i]=a[i];
    sort(b,b+n);
    for(int i=0;i<n;i++){
        hashy[b[i]]=i/k;
    }
    for(int i=0;i<n;i++)a[i]=hashy[a[i]];
    memset(dp,-1,sizeof(dp));
    printf("%d\n",n-DP(0,0));
}

Compilation message

studentsko.cpp: In function 'int main()':
studentsko.cpp:20:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&k);
                        ^
studentsko.cpp:21:52: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<n;i++)scanf("%d",&a[i]),b[i]=a[i];
                                                    ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 128 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 220 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 276 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 352 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 388 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 416 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 416 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 416 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 416 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -