Submission #1081259

#TimeUsernameProblemLanguageResultExecution timeMemory
1081259chaoslongRabbit Carrot (LMIO19_triusis)C++14
0 / 100
0 ms348 KiB
// Calm down. // Think three times, code twice. #include "bits/stdc++.h" #define forr(_a,_b,_c) for(int _a = (_b); _a <= (_c); ++_a) #define ford(_a,_b,_c) for(int _a = (_b) + 1; _a --> (_c);) #define forf(_a,_b,_c) for(int _a = (_b); _a < (_c); ++_a) #define st first #define nd second #define ll long long #define ull unsigned long long #define pii pair <int,int> #define pll pair <ll,ll> #define piii pair <int,pii> #define vi vector <int> #define pb push_back #define mp make_pair #define all(x) begin(x),end(x) #define mask(i) (1LL << (i)) #define bit(x, i) (((x) >> (i)) & 1) #define bp __builtin_popcountll #define file "test" using namespace std; const int N = 2e5 + 5; const int mod = 1e9 + 7; // 998244353 const ll oo = 1e18; ll n, m; ll a[N]; void to_nho_cau() { cin >> n >> m; vector<ll> f; f.pb((ll)-1); ll ans = 0, pre = 0; bool kt = 0; forr(i, 1, n) { cin >> a[i]; if(i == 1 && a[i] > m) { pre = 2 * m; ans++; kt = 1; } else f.pb(a[i]); f.pb(a[i] + m); } if(kt) { forr(i, 1, 2 * (n - 1)) { if(i & 1 && f[i] > pre) { ans++; f[i+1] = pre + m; } if(i % 2 == 0) { pre = f[i]; } } } // else forr(i, 1, 2 * n) { // if(i % 2 == 0 && i != 2 * n) { // if(f[i] < f[i+1]) ans++; // } // } cout << ans << "\n"; } signed main(){ ios_base::sync_with_stdio(0);cin.tie(0); #ifdef LOCAL freopen(file".inp","r",stdin); freopen(file".out","w",stdout); #endif int t = 1; //cin >> t; while(t--) to_nho_cau(); } /* 1.self check: 2.long long 3.size of array 4.code for testing 5.initializing 6.modulo number */ /** ∧__∧ (`•ω• )づ__∧ (つ  /( •ω•。) しーJ (nnノ) pat pat **/ /** /\_/\ * (= ._.) * / >☕ \>💻 **/

Compilation message (stderr)

triusis.cpp:87:9: warning: "/*" within comment [-Wcomment]
   87 | /**  /\_/\
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...