Submission #1181987

#TimeUsernameProblemLanguageResultExecution timeMemory
1181987random_nameProgression (NOI20_progression)C++20
15 / 100
3096 ms2580 KiB
#include <bits/stdc++.h> using namespace std; #define long long long #pragma region overloadings template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1, T2>& pair){ os << '(' << pair.first << ", " << pair.second << ')'; return os; } template <typename T1, typename T2> ostream& operator<< (ostream& os, const map<T1, T2>& map_var){ for(pair<T1, T2> i: map_var){ os << '(' << i.first << ": " << i.second << ") "; } return os; } template <typename T> ostream& operator<< (ostream& os, const vector<T>& vec){ for(T i: vec) os << i << ' '; return os; } template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1, T2>& pair){ is >> pair.first >> pair.second; return is; } template <typename T> istream& operator>> (istream& is, vector<T>& vec){ for(int i = 0; i < vec.size(); i++) is >> vec[i]; return is; } #pragma endregion bool test_cases = false; ifstream ifile; ofstream ofile; // #define cin ifile // #define cout ofile void solution(){ int n, q; cin >> n >> q; vector<int> D(n); cin >> D; int l, r, s, c; while(q--){ int op; cin >> op; switch(op){ case 1: cin >> l >> r >> s >> c; for(int i = l-1; i < r; i++){ D[i] += s + (i-l+1)*c; } break; case 2: cin >> l >> r >> s >> c; for(int i = l-1; i < r; i++){ D[i] = s + (i-l+1)*c; } break; case 3: cin >> l >> r; int longest_sub = 1; int current_inc = 0; int current_sub = 1; for(int i = l; i < r; i++){ int inc = D[i] - D[i-1]; if(inc != current_inc){ current_sub = 1; } current_inc = inc; current_sub++; longest_sub = max(longest_sub, current_sub); } cout << longest_sub << '\n'; break; } } } int main(){ ifile.open("circlecross.in"); ofile.open("circlecross.out"); if(test_cases){ int t; cin >> t; while(t--){ solution(); } } else{ solution(); } }
#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...