Submission #73503789


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
struct Init { Init() { ios::sync_with_stdio(0); cin.tie(0); cout << setprecision(13); } }init;
using ll = long long;
using pll = pair<ll, ll>;
const int inf = 1073741823;
const long long INF = 1LL << 60;
#define el '\n'
#define spa " "
#define pb emplace_back
#define rep(i, s, n) for(int i = (s); i < (int)(n); i++)
#define rrep(i, s, n) for(int i = (int)(n) - 1; i >= (s); i--)
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define unless(c) if(!(c))
#define until(c) while(!(c))

int sub(){
    return 0;
}

int solve() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<pll> b(n);
    rep(i, 0, n){
        cin >> a[i];
        b[i].first = a[i];
        b[i].second = i;
    }
    sort(all(b));
    ll ans = 1;
    for(auto [x, p] : b){
        ll z = x+1;
        ll er = 1;
        rep(i, p+1, n){
            if(a[i] == z){
                er++;
                z++;
            }
        }
        ans = max(ans, er);
    }
    cout << ans << el;
    return 0;
}

int main() {
    int t = 1;
    // cin >> t;
    rep(i, 0, t) {
        solve();
    }
    return 0;
}

Submission Info

Submission Time
Task D - Max Straight
User tuttutu256
Language C++23 (GCC 15.2.0)
Score 0
Code Size 1271 Byte
Status TLE
Exec Time > 2000 ms
Memory 8028 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 12
TLE × 14
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3564 KiB
00_sample_01.txt AC 1 ms 3484 KiB
00_sample_02.txt AC 1 ms 3412 KiB
01_random_00.txt AC 1 ms 3580 KiB
01_random_01.txt AC 1 ms 3524 KiB
01_random_02.txt AC 1 ms 3452 KiB
01_random_03.txt TLE > 2000 ms 8028 KiB
01_random_04.txt TLE > 2000 ms 8008 KiB
01_random_05.txt TLE > 2000 ms 5960 KiB
01_random_06.txt AC 909 ms 4572 KiB
01_random_07.txt TLE > 2000 ms 7992 KiB
01_random_08.txt AC 1729 ms 5124 KiB
01_random_09.txt AC 1 ms 3692 KiB
01_random_10.txt TLE > 2000 ms 7980 KiB
01_random_11.txt TLE > 2000 ms 7896 KiB
01_random_12.txt AC 112 ms 3784 KiB
01_random_13.txt TLE > 2000 ms 7880 KiB
01_random_14.txt AC 9 ms 3580 KiB
01_random_15.txt TLE > 2000 ms 7992 KiB
01_random_16.txt TLE > 2000 ms 5724 KiB
01_random_17.txt TLE > 2000 ms 7880 KiB
01_random_18.txt TLE > 2000 ms 7812 KiB
01_random_19.txt TLE > 2000 ms 7980 KiB
01_random_20.txt TLE > 2000 ms 6600 KiB
01_random_21.txt TLE > 2000 ms 7880 KiB
01_random_22.txt AC 96 ms 3712 KiB