Submission #473541

# Submission time Handle Problem Language Result Execution time Memory
473541 2021-09-15T16:30:38 Z Beboo44 Doktor (COCI17_doktor) C++14
10 / 100
173 ms 7316 KB
#include <bits/stdc++.h>
using namespace std;
#define all(v)			((v).begin()), ((v).end())
#define sz(v)			((int)((v).size()))
typedef long long ll;
typedef vector<int> vi;
typedef vector<pair<ll , int> > vpli;
typedef set<char> st;
typedef stack<int> s;
typedef deque<int> dq;
typedef queue<int> q;
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0)


int main()
{
   ll n;
   cin>>n;
   vector<ll>v(n);
   for(int i=0; i<n; ++i){
    cin>>v[i];
   }
   ll sum = 1;
   ll maxi=0;
   ll indx=0;
   ll start=0;
   for(int i=1; i<n; ++i){
    if(v[i]==v[i-1]+1){
        ++sum;
    }
    else{
        if(sum>maxi){
            maxi=sum;
            sum=1;
            indx=start;
            start = i;
        }
    }
   }
   if(sum>maxi){
    indx = start;
    maxi=sum;
   }
   if(indx<=n/2){
    cout<<v[indx]<<" "<<v[v[indx]-1];
   }
   else{
    cout<<v[indx+maxi-1]<<" "<<v[indx+maxi-2];
   }






    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Failed 1 ms 204 KB Checker failed - contact admins or jury
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Incorrect 1 ms 292 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 1504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 173 ms 7316 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 99 ms 4312 KB Output isn't correct
2 Halted 0 ms 0 KB -