답안 #520866

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
520866 2022-01-31T10:20:18 Z Psudora Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
4 ms 7364 KB
#include <bits/stdc++.h> 
#include <ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;  
template <class T> using Tree = tree<T, null_type, less<T>,rb_tree_tag, tree_order_statistics_node_update>;
typedef tree < pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
bool cmp(pair<int, int>& a, pair<int, int>& b) { return a.second < b.second; }  
#define ll long long 
#define mod 1000000007 
#define mod2 99824435 
const int INF =  (int)1e9;  
 
int add(int i, int j) {
	if ((i += j) >= mod)
		i -= mod;
	return i;
} 
int sub(int i, int j) {
	if ((i -= j) < 0)
		i += mod;
	return i;
} 
const int MAXN = 201010; 
const int N = 3e5+10;  
vector<int>adj[N];
vector<int> st, en;
vector<vector<int>>up;   
const int maxn = 1000;   
int longest(const vector<int>&sub){
    vector<int>min_ending;
    for(int i : sub){
        int pos = upper_bound(sub.begin(), sub.end(), i)-sub.begin();
        if(pos == min_ending.size()){
            min_ending.push_back(i);
        }
        else min_ending[pos] = i;
    }
    return min_ending.size();
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("herding.in","r",stdin);
    //freopen("herding.out","w",stdout);   
    //set<int, greater<int>>st; 
    //
    int n, jump_hight;
    cin >> n >> jump_hight;
    vector<int>poles(n);
    for(int i = 0; i < n; i++){
        cin >> poles[i];
    }
    vector<int>unchange;
    for(int i = 1; i <= n; i++){
        if(i*jump_hight-poles[i]){
            unchange.push_back(i*jump_hight-poles[i]);
        }
    }
    cout << n-longest(unchange) <<"\n";
    return 0;
}

Compilation message

triusis.cpp: In function 'int longest(const std::vector<int>&)':
triusis.cpp:34:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         if(pos == min_ending.size()){
      |            ~~~~^~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 7364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 7364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 7364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 7364 KB Output isn't correct
2 Halted 0 ms 0 KB -