Submission #882750

#TimeUsernameProblemLanguageResultExecution timeMemory
882750BinRabbit Carrot (LMIO19_triusis)C++17
0 / 100
1 ms2396 KiB
// OwO mãi simp tnqa >~< UwU //#pragma GCC target ("avx2") //#pragma GCC optimize("Ofast,fast-math,unroll-loops") #include <bits/stdc++.h> #define int long long #define f first #define si second #define ll long long #define ul unsigned long long #define pb push_back #define rep(i, a, b) for (int i = a; i <= b; ++i) #define repp(i, a, b) for (int i = a; i >= b; --i) #define TEST "TEST" const ll maxn = 2e5 + 2; //const ll oo = 1e18; const ll oo = 0x3f3f3f3f3f3f3f3f; const ll mod[] = {(ll) 1e9 + 7, (ll)1e9 + 2277, (ll)1e9 + 5277, (ll)1e9 + 8277, (ll)1e9+ 9277}; const ll MOD = 1e9 + 7; //const int LOG = 30; const ll base = 71; using namespace std; inline int readInt(){char c;while(c=getchar(),c!='-'&&(c<'0'||c>'9'));bool sign=(c=='-');if(sign)c=getchar();int n=c-'0';while(c=getchar(),c>='0'&&c<='9')n=10*n+c-'0';return(!sign)?n:-n;} inline ll readLong(){char c;while(c=getchar(),c!='-'&&(c<'0'||c>'9'));bool sign=(c=='-');if(sign)c=getchar();ll n=c-'0';while(c=getchar(),c>='0'&&c<='9')n=10*n+c-'0';return(!sign)?n:-n;} inline ul readUL(){char c;while(c=getchar(),c!='-'&&(c<'0'||c>'9'));bool sign=(c=='-');if(sign)c=getchar();ll n=c-'0';while(c=getchar(),c>='0'&&c<='9')n=10*n+c-'0';return(!sign)?n:-n;} inline string readString() {char c;while(c=getchar(),c==' '||c=='\n'||c=='\t');string s({c});while(c=getchar(),c!=EOF&&c!=' '&&c!='\n'&&c!='\t')s+=c;return s;} int n, m, a[maxn], b[maxn], kq; void sol(){ n = readInt(); m = readInt(); rep(i, 1, n){ a[i] = readInt(); } rep(i, 1, n){ if (i > 1 && a[i] < a[i - 1]){ kq++; continue; } if (m * i - a[i] < 0) continue; if (a[i] - a[i - 1] <= m){ kq++; } else a[i] = a[i - 1] + m; } cout << n - kq; } signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); if (fopen(TEST".INP","r")){ freopen(TEST".INP","r",stdin); freopen(TEST".OUT","w",stdout); } int t; t = 1; while (t--){ sol(); cout << "\n"; } return 0; }

Compilation message (stderr)

triusis.cpp: In function 'int main()':
triusis.cpp:54:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   54 |         freopen(TEST".INP","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:55:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |         freopen(TEST".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...