답안 #689684

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
689684 2023-01-29T05:48:45 Z true22 Progression (NOI20_progression) C++14
0 / 100
3000 ms 3668 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef long double ld;

typedef pair<ll, ll> pl;
typedef vector<ll> vl;   
typedef vector<pl> vp;

#define nl "\n"
#define fr first
#define sc second
#define pb push_back

#define all(x) x.begin(), x.end()
#define fur(i, a, b) for(ll i = a; i <= b; ++i)
#define ruf(i, a, b) for(ll i = a; i >= b; --i)
#define pv(x) for(auto k : x){cout << k << " ";} cout << nl

ll n;
vl d;

void patch(ll l, ll r, ll s, ll c){
    fur(i, l, r)
        d[i] += s + (i - l)*c;
}

void rewrite(ll l, ll r, ll s, ll c){
    fur(i, l, r)
        d[i] = s + (i - l)*c;
}

ll lenpro(ll l, ll r){
    if (l == r){
        return 1;
    }
    
    ll mxl = 1;
    ll k = d[l + 1] - d[l];
    ll len = 1;
    fur(i, l + 1, r){
        if (d[i] - d[i - 1] == k){
            len++;
            mxl = max(len, mxl);
        }else{
            len = 2;
            k = d[i] - d[i - 1]; 
        }
    }   
    return mxl;
}


void solve(){
    ll t;
    cin >> t;
    if (t == 3){
     //   cout << "evaluate" << nl;
        ll l, r;
        cin >> l >> r;
    //    cout << "in [" << l << ", " << r << "] : " << lenpro(l, r) << nl; 
        cout << lenpro(l, r) << nl;
    }
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);

    ll q;
    cin >> n >> q;
    d.resize(n + 1);
    fur(i, 1, n)
        cin >> d[i];

    while(q--){
        
        solve();
    }
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3051 ms 2928 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 196 ms 3668 KB Output is correct
2 Correct 79 ms 1136 KB Output is correct
3 Correct 68 ms 1132 KB Output is correct
4 Correct 66 ms 1152 KB Output is correct
5 Correct 71 ms 1212 KB Output is correct
6 Correct 71 ms 1176 KB Output is correct
7 Correct 68 ms 1216 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 316 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 3054 ms 3356 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 70 ms 2820 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 196 ms 3668 KB Output is correct
2 Correct 79 ms 1136 KB Output is correct
3 Correct 68 ms 1132 KB Output is correct
4 Correct 66 ms 1152 KB Output is correct
5 Correct 71 ms 1212 KB Output is correct
6 Correct 71 ms 1176 KB Output is correct
7 Correct 68 ms 1216 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 316 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 3054 ms 3356 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3051 ms 2928 KB Time limit exceeded
2 Halted 0 ms 0 KB -