Submission #797994

#TimeUsernameProblemLanguageResultExecution timeMemory
797994iloveroseanneRabbit Carrot (LMIO19_triusis)C++14
0 / 100
1 ms212 KiB
/// 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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...