Submission #473554

# Submission time Handle Problem Language Result Execution time Memory
473554 2021-09-15T16:39:49 Z Beboo44 Doktor (COCI17_doktor) C++14
0 / 100
179 ms 4044 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 Failed 1 ms 204 KB Checker failed - contact admins or jury
# Verdict Execution time Memory Grader output
1 Failed 0 ms 204 KB Checker failed - contact admins or jury
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
# 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 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Failed 3 ms 332 KB Checker failed - contact admins or jury
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 1004 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 179 ms 4044 KB Checker failed - contact admins or jury
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 95 ms 2508 KB Output isn't correct
2 Halted 0 ms 0 KB -