Submission #711822

# Submission time Handle Problem Language Result Execution time Memory
711822 2023-03-17T14:41:26 Z Thienu Progression (NOI20_progression) C++17
15 / 100
3000 ms 3980 KB
#include <bits/stdc++.h>

using namespace std;

#define u_map unordered_map
#define u_set unordered_set
#define u_multiset unordered_multiset
#define int long long
using ll = long long;
using vvi = vector<vector<int>>;
using vi = vector<int>;
using vvll = vector<vector<long long>>;
using vll = vector<long long>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;

template<typename C> struct rge{C l, r;};
template<typename C> rge<C> range(C i, C j) { return rge<C>{i, j}; }
template<typename C> ostream& operator<<(ostream &os, rge<C> &r) { os << '{'; for(auto it = r.l; it != r.r; it++) os << "," + (it == r.l) << *it; os << '}'; return os; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '{' << p.first << "," << p.second << '}'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ","; return os << '}'; }
void dbg_out() { cerr << ']' << endl; }
template<typename A> void dbg_out(A H) { cerr << H; dbg_out(); }
template<typename A, typename B, typename... C> void dbg_out(A H, B G, C... T) { cerr << H << ","; dbg_out(G, T...); }
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = [", dbg_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void solve(){
    int n, q;
    cin >> n >> q;
    vll v(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    while(q--){
        int t;
        cin >> t;
        if(t == 1){
            int l, r; ll s, c;
            cin >> l >> r >> s >> c;
            l--;
            ll add_by = s;
            for(int i = l; i < r; i++){
                v[i] += add_by;
                add_by += c;
            }
        }else if(t == 2){
            int l, r; ll s, c;
            cin >> l >> r >> s >> c;
            l--;
            ll add_by = s;
            for(int i = l; i < r; i++){
                v[i] = add_by;
                add_by += c;
            }
        }else{
            debug(v);
            int l, r;
            cin >> l >> r;
            l--;
            int run = 0;
            ll last = -1e18;
            int ans = 0;
            for(int i = l; i+1 < r; i++){
                ll dif = v[i+1] - v[i];
                if(dif == last){
                    run++;
                } else {
                    last = dif;
                    run = 1;
                }
                ans = max(ans, run);
            }
            cout << ans + 1 << endl;
        }
    }
}
#undef int
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 3044 ms 2800 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 328 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 2 ms 332 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
15 Correct 2 ms 336 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 336 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 1 ms 328 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 528 ms 3632 KB Output is correct
2 Correct 398 ms 844 KB Output is correct
3 Correct 409 ms 844 KB Output is correct
4 Correct 394 ms 828 KB Output is correct
5 Correct 417 ms 996 KB Output is correct
6 Correct 438 ms 956 KB Output is correct
7 Correct 416 ms 940 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Execution timed out 3061 ms 2812 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 309 ms 2988 KB Output is correct
2 Correct 208 ms 712 KB Output is correct
3 Correct 188 ms 496 KB Output is correct
4 Correct 188 ms 404 KB Output is correct
5 Correct 210 ms 496 KB Output is correct
6 Correct 184 ms 464 KB Output is correct
7 Correct 186 ms 520 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 3080 ms 3980 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 528 ms 3632 KB Output is correct
2 Correct 398 ms 844 KB Output is correct
3 Correct 409 ms 844 KB Output is correct
4 Correct 394 ms 828 KB Output is correct
5 Correct 417 ms 996 KB Output is correct
6 Correct 438 ms 956 KB Output is correct
7 Correct 416 ms 940 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Execution timed out 3061 ms 2812 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3044 ms 2800 KB Time limit exceeded
2 Halted 0 ms 0 KB -