Submission #797994

# Submission time Handle Problem Language Result Execution time Memory
797994 2023-07-30T08:45:48 Z iloveroseanne Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
1 ms 212 KB
/// PARK CHAEYOUNG IS MY LOVE
/// Author: Ngo Ba Van
/// roses_are_rosie
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define MASK(i) (1LL<<i)
#define BIT(x,i) (x&MASK(i))
#define ONBIT(x,i) (x|MASK(i))
#define OFFBIT(x,i) (x&~MASK(i))
#define COUNT(x) (__builtin_popcount(x))
using ii=pair<int,int>;
const ll N=2e5+5,M=1e9+7;
ll n,m,res,a[N];
vector<int>dp;
void nhap()
{
    cin>>n>>m;
    for (int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        a[i]=m*i-x;
    }
    for (int i=1;i<=n;i++)
    {
        int pos=upper_bound(dp.begin(),dp.end(),a[i])-dp.begin();
        if (pos==dp.size()) dp.push_back(a[i]);
        else
            dp[pos]=a[i];
    }
    cout<<n-dp.size();
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#define task ""
#define task "a"
if(fopen(task".inp","r"))
{
    freopen(task".inp","r",stdin);
    freopen(task".out","w",stdout);
}
int t=1;
//cin>>t;
while (t--)
nhap();
}

Compilation message

triusis.cpp:40: warning: "task" redefined
   40 | #define task "a"
      | 
triusis.cpp:39: note: this is the location of the previous definition
   39 | #define task ""
      | 
triusis.cpp: In function 'void nhap()':
triusis.cpp:30:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         if (pos==dp.size()) dp.push_back(a[i]);
      |             ~~~^~~~~~~~~~~
triusis.cpp: In function 'int main()':
triusis.cpp:43:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |     freopen(task".inp","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:44:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |     freopen(task".out","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -