Submission #250484

#TimeUsernameProblemLanguageResultExecution timeMemory
250484Vladikus004Doktor (COCI17_doktor)C++14
60 / 100
542 ms30020 KiB
#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 = min(l, a[i]); r = i + 1; } } cout << a[l - 1]<< " " << a[r - 1]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...