답안 #958421

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
958421 2024-04-05T19:01:07 Z shokal_kishan Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
1 ms 500 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
vector<vector<int>>gr;
vector<int>ans;
int f(int ind){
    int sm=0;
    for(auto x:gr[ind]){
        sm+=f(x)+1;
    }
    ans[ind]=sm;
    return sm;
}
int lcs(vector<int>arr1,vector<int>arr2){
    int n=arr1.size();
    int m=arr2.size();
    vector<vector<int>>dp(2,vector<int>(m+1,0));
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            dp[1][j]=max(dp[0][j],dp[1][j-1]);
            int tm = dp[0][j-1];
            if(arr1[i-1]==arr2[j-1])tm++;
            dp[1][j]=max(tm,dp[1][j]);
        }
        dp[0]=dp[1];

    }
    return dp[0][m];
}

int32_t main(){
    int n,m;cin>>n>>m;
    vector<int>arr(n),arr2(n),v;
    for(int i=0;i<n;i++) cin>>arr[i];
    int ans=0;
    int pr=0;
    for(int i=0;i<n;i++){
        if(arr[i]-pr>m) ans++,pr=INT_MAX;
        else pr = arr[i];
    }
    cout<<ans<<endl;

    
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 500 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 1 ms 500 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 500 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 1 ms 500 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 500 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 1 ms 500 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 500 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 1 ms 500 KB Output isn't correct
8 Halted 0 ms 0 KB -