1290A - Mind Control - CodeForces Solution


brute force data structures implementation *1600

Please click on ads to support us..

C++ Code:

#include <bits/stdc++.h>

// iostream is too mainstream

#include <cstdio>

// bitch please

#include <iostream>

#include <algorithm>

#include <cstdlib>

#include <vector>

#include <set>

#include <map>

#include <queue>

#include <stack>

#include <list>

#include <cmath>

#include <iomanip>

#include <time.h>

#define dibs reserve

#define OVER9000 1234567890

#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)

#define tisic 47

#define soclose 1e-8

#define chocolate win

// so much chocolate

#define patkan 9

#define ff first

#define ss second

#define abs(x) (((x) < 0)?-(x):(x))

#define uint unsigned int

#define dbl long double

#define pi 3.14159265358979323846

using namespace std;

// mylittledoge



using cat = long long;



#ifdef DONLINE_JUDGE

	// palindromic tree is better than splay tree!

	#define lld I64d

#endif



int main() {

	cin.sync_with_stdio(0);

	cin.tie(0);

	cout << fixed << setprecision(10);

	int T;

	cin >> T;

	while(T--) {

		int N, M, K;

		cin >> N >> M >> K;

		M--;

		K = min(K, M);

		vector<int> A(N);

		for(int i = 0; i < N; i++) cin >> A[i];

		int ans = 0;

		for(int i = 0; i <= K; i++) {

			int cur = OVER9000;

			for(int j = 0; j <= M-K; j++)

				cur = min(cur, max(A[i+j], A[N-1-(M-K-j+K-i)]));

			ans = max(ans, cur);

		}

		cout << ans << "\n";

	}

	return 0;

}



// look at my code

// my code is amazing


Comments

Submit
0 Comments
More Questions

1424M - Ancient Language
600C - Make Palindrome
1669D - Colorful Stamp
1669B - Triple
1669A - Division
1669H - Maximal AND
1669E - 2-Letter Strings
483A - Counterexample
3C - Tic-tac-toe
1669F - Eating Candies
1323B - Count Subrectangles
991C - Candies
1463A - Dungeon
1671D - Insert a Progression
1671A - String Building
1671B - Consecutive Points Segment
1671C - Dolce Vita
1669G - Fall Down
4D - Mysterious Present
1316B - String Modification
1204A - BowWow and the Timetable
508B - Anton and currency you all know
1672A - Log Chopping
300A - Array
48D - Permutations
677C - Vanya and Label
1583B - Omkar and Heavenly Tree
1703C - Cypher
1511C - Yet Another Card Deck
1698A - XOR Mixup