Submission #319907

# Submission time Handle Problem Language Result Execution time Memory
319907 2020-11-06T17:59:48 Z gustason Doktor (COCI17_doktor) C++14
0 / 100
60 ms 5604 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int best = 1, from = 1, to = 1;
    for(int i = n-1; i > 0;) {
        int start = a[i], l = 1;
        while(i > 0 && a[i-1] == a[i]+1 && i != start-1) {
            l++;
            i--;
        }
        if (l == 1) {
            i--;
            continue;
        }
        if (l > best) {
            best = l;
            from = a[i];
            to = a[a[i]-1];
        }
    }
    cout << from << " " << to << "\n";
    return 0;
}
//~ check for overflows
# Verdict Execution time Memory Grader output
1 Failed 1 ms 364 KB Checker failed - contact admins or jury
# Verdict Execution time Memory Grader output
1 Failed 1 ms 384 KB Checker failed - contact admins or jury
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Failed 2 ms 364 KB Checker failed - contact admins or jury
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 1164 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 60 ms 5604 KB Checker failed - contact admins or jury
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 3308 KB Output isn't correct
2 Halted 0 ms 0 KB -