답안 #87685

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
87685 2018-12-01T22:22:42 Z jasony123123 Doktor (COCI17_doktor) C++11
70 / 100
244 ms 20576 KB
/*
Mail.Ru Cup 2018 Round 3
https://codeforces.com/contests/1056
*/
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define FOR(i,start,end) for(int i=start;i<(int)(end);i++)
#define FORE(i,start,end) for(int i=start;i<=(int)end;i++)
#define RFOR(i,start,end) for(int i = start; i>end; i--)
#define RFORE(i,start,end) for(int i = start; i>=end; i--)
#define vsort(a) sort(a.begin(), a.end());
#define mp make_pair
#define v vector
#define sf scanf
#define pf printf

typedef long long ll;
typedef pair<int, int > pii;
//template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void io();

int N;
int cnt[1000010];
int a[500010];
int mx = 0;

int main() {
	//io();
	cin >> N;
	FORE(i, 1, N) {
		int val; cin >> val;
		a[i] = val;
		cnt[val + i]++;
		if (cnt[val + i] > cnt[mx])
			mx = val + i;
	}
	double mid = mx / 2.0;
	double part = min(N - mid, mid - 1);
	int l = (int)(mid - part), r = (int)(mid + part);
	cout << a[l] << " " << a[r] << "\n";
	return 0;
}


void io() {
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.out", "w", stdout);
#else
	// online submission
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

Compilation message

doktor.cpp: In function 'void io()':
doktor.cpp:53:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("input.in", "r", stdin);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
doktor.cpp:54:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("output.out", "w", stdout);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 580 KB Output is correct
2 Correct 3 ms 620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 632 KB Output is correct
2 Incorrect 2 ms 848 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 852 KB Output is correct
2 Correct 117 ms 3896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 36 ms 4288 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 244 ms 12232 KB Output is correct
2 Correct 191 ms 12232 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 123 ms 15148 KB Output is correct
2 Correct 190 ms 20576 KB Output is correct