Submission #250486

# Submission time Handle Problem Language Result Execution time Memory
250486 2020-07-18T07:40:43 Z Vladikus004 Doktor (COCI17_doktor) C++14
60 / 100
435 ms 26840 KB
#include <bits/stdc++.h>
#define inf 2e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;

const int N = 500000 + 3;
int n, a[N], b[N];
map <int, int> cnt;
pii mx = {-inf, -inf};

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif // LOCAL
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++){
        b[i] = a[i] + i;
        cnt[b[i]]++;
        mx = max(mx, make_pair(cnt[b[i]], b[i]));
    }
    int l = n, r = -1;
    for (int i = 0; i < n; i++){
        if (b[i] == mx.second){
            l = a[i] - 1;
            r = i;
        }
    }
    cout << a[l]<< " " << a[r];
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 512 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 50 ms 4088 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 435 ms 21116 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 227 ms 12480 KB Output is correct
2 Correct 229 ms 26840 KB Output is correct