Submission #250486

#TimeUsernameProblemLanguageResultExecution timeMemory
250486Vladikus004Doktor (COCI17_doktor)C++14
60 / 100
435 ms26840 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 = a[i] - 1; r = i; } } cout << a[l]<< " " << a[r]; }
#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...