Submission

Status:

----------

Subtask/Task Score:

0/100

Score: 0

User: tull

Problemset: Consecutive Subsequence

Language: cpp

Time: 0.003 second

Submitted On: 2026-05-06 09:50:30

#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define bp '\n'
#define vp cout<<'\n';
#define all(A) A.begin(),A.end()
using pii=pair<int,int>;
const int MOD=1e9+7;
const int MNLL=-1e18;
const int MXLL=1e18;
const int N=2e5+10;
int p[104];
signed main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    string s;
    int ls=MNLL,nw,cnt=0;
    vector<int>con,mos;
    while (cin>>s)
    {
        if(!isdigit(s[(int32_t)s.size()-1]))break;
        nw=stoll(s,nullptr,10);
        if(con.empty() or nw==con.back()+1){
            con.emplace_back(nw);
        }else{
            con.clear();
            con.emplace_back(nw);
        }
        if(con.size()>mos.size()){
            mos=con;
        }
    }
    for(auto&e:mos)cout<<e<<' ';
    
}