Submission #689667

#TimeUsernameProblemLanguageResultExecution timeMemory
689667zeroesandonesProgression (NOI20_progression)C++17
9 / 100
145 ms6880 KiB
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef long double ld; typedef vector<ll> vi; typedef pair<ll, ll> pi; #define FOR(i, j, k) for (ll i = j; i < (ll) k; ++i) #define FORD(i, j, k) for (ll i = j; i >= (ll) k; --i) #define nl "\n" #define sp " " #define all(x) (x).begin(), (x).end() #define sc second #define fr first #define pb emplace_back void solve() { ll n, q; cin >> n >> q; ll d[n + 1] = {}; FOR(i, 1, n + 1) { cin >> d[i]; } vi diff; FOR(i, 2, n + 1) { diff.pb(d[i] - d[i - 1]); } ll ans = 1, cnt = 1; FOR(i, 1, diff.size()) { if(diff[i] != diff[i - 1]) { cnt = 1; } else { ++cnt; } ans = max(ans, cnt + 1); } while(q--) { int t; cin >> t; if(t == 1) { ll l, r, s, c; cin >> l >> r >> s >> c; } else if(t == 2) { ll l, r, s, c; cin >> l >> r >> s >> c; ans = n; } else { ll l, r; cin >> l >> r; cout << ans << nl; } } } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll t = 1; // cin >> t; while (t--) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...