<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Codeforces Round #616 (Div. 2) C. Mind Control 博弈論 枚舉

      C. Mind Control

      time limit per test1 second
      memory limit per test256 megabytes

      You and your n?1 friends have found an array of integers a1,a2,…,an. You have decided to share it in the following way: All n of you stand in a line in a particular order. Each minute, the person at the front of the line chooses either the first or the last element of the array, removes it, and keeps it for himself. He then gets out of line, and the next person in line continues the process.

      You are standing in the m-th position in the line. Before the process starts, you may choose up to k different people in the line, and persuade them to always take either the first or the last element in the array on their turn (for each person his own choice, not necessarily equal for all people), no matter what the elements themselves are. Once the process starts, you cannot persuade any more people, and you cannot change the choices for the people you already persuaded.

      Suppose that you're doing your choices optimally. What is the greatest integer x such that, no matter what are the choices of the friends you didn't choose to control, the element you will take from the array will be greater than or equal to x?

      Please note that the friends you don't control may do their choice arbitrarily, and they will not necessarily take the biggest element available.

      Input

      The input consists of multiple test cases. The first line contains a single integer t (1≤t≤1000) — the number of test cases. The description of the test cases follows.

      The first line of each test case contains three space-separated integers n, m and k (1≤m≤n≤3500, 0≤k≤n?1) — the number of elements in the array, your position in line and the number of people whose choices you can fix.

      The second line of each test case contains n positive integers a1,a2,…,an (1≤ai≤109) — elements of the array.

      It is guaranteed that the sum of n over all test cases does not exceed 3500.

      Output

      For each test case, print the largest integer x such that you can guarantee to obtain at least x.

      Example

      input
      4
      6 4 2
      2 9 2 3 8 5
      4 4 1
      2 13 60 4
      4 1 3
      1 2 2 1
      2 2 0
      1 2
      output
      8
      4
      1
      1

      Note

      In the first test case, an optimal strategy is to force the first person to take the last element and the second person to take the first element.

      the first person will take the last element (5) because he or she was forced by you to take the last element. After this turn the remaining array will be [2,9,2,3,8];
      the second person will take the first element (2) because he or she was forced by you to take the first element. After this turn the remaining array will be [9,2,3,8];
      if the third person will choose to take the first element (9), at your turn the remaining array will be [2,3,8] and you will take 8 (the last element);
      if the third person will choose to take the last element (8), at your turn the remaining array will be [9,2,3] and you will take 9 (the first element).
      Thus, this strategy guarantees to end up with at least 8. We can prove that there is no strategy that guarantees to end up with at least 9. Hence, the answer is 8.

      In the second test case, an optimal strategy is to force the first person to take the first element. Then, in the worst case, both the second and the third person will take the first element: you will end up with 4.

      題意

      現在有n個人,n個物品,你站在第m個位置,你可以在游戲的一開始控制k個人使得這k個人只能選擇前面,或者只能選擇后面的物品。

      游戲的每一輪,人們按照順序去拿物品,要么只能拿最前面的,要么只能拿最后面的,問你最少能拿到多大的價值的物品。

      題解

      視頻題解:https://www.bilibili.com/video/av86529667/

      首先控制的k個人,一定是前k個人。

      我們枚舉這k個人拿前面i個,那么后面就會有k-i個人,這個是由我控制的。

      然后還剩下m-k-1個人,我們枚舉前面有j個人,那么后面就會有m-k-1-j個人,這個是由對方控制的。

      最后我從前面的一個物體,和后面的一個物體進行二選一,選擇最大的,這個是由我控制的。

      由我控制的部分取max,由別人控制的部分取min,暴力枚舉就可以了。

      代碼

      #include<bits/stdc++.h>
      using namespace std;
      const int maxn = 4005;
      int n,m,k,a[maxn];
      void solve(){
          cin>>n>>m>>k;
          for(int i=0;i<n;i++){
              cin>>a[i];
          }
          k=min(m-1,k);
          int ans = 0;
          for(int i=0;i<=k;i++){
              int tmp=1e9;
              for(int j=0;j<m-k;j++){
                  tmp=min(tmp,max(a[i+j],a[n-1-(k-i)-(m-k-j-1)]));
              }
              ans=max(ans,tmp);
          }
          cout<<ans<<endl;
      }
      int main(){
          int t;
          cin>>t;
          while(t--){
              solve();
          }
      }
      
      posted @ 2020-02-03 19:23  qscqesze  閱讀(586)  評論(4)    收藏  舉報
      主站蜘蛛池模板: 粉嫩一区二区三区国产精品| 亚洲一区二区av免费| 亚洲成人av日韩在线| 国产蜜臀在线一区二区三区| 又黄又无遮挡AAAAA毛片| 国产av一区二区久久蜜臀| 无码AV中文字幕久久专区| 日韩中文字幕v亚洲中文字幕| 久久九九兔免费精品6| 国产精一区二区黑人巨大| 莱阳市| 久久精品国产亚洲av熟女| 亚洲精品天堂一区二区| 欧美性猛交xxxx乱大交丰满| 中文字幕久久精品波多野结| 国内精品视频一区二区三区八戒| 亚洲乱码国产乱码精品精| 国内自拍偷拍一区二区三区| 亚洲高清WWW色好看美女| 亚洲精品熟女国产| 亚洲第一香蕉视频啪啪爽| 久久天天躁狠狠躁夜夜婷 | 国产精品伦人视频免费看| 亚洲va在线∨a天堂va欧美va| 亚洲av乱码久久亚洲精品| 亚洲 日本 欧洲 欧美 视频| 丁香婷婷激情俺也去俺来也| 亚洲av成人精品日韩一区| 亚洲欧美综合精品成| 日日爽日日操| 商洛市| 一区二区亚洲精品国产精| 91精品91久久久久久| 少妇愉情理伦片丰满丰满午夜| 国内自拍第一区二区三区| 永久天堂网 av手机版| 国模肉肉视频一区二区三区| 91中文字幕在线一区| 欧美熟妇乱子伦XX视频| 国产精品视频一区二区三区无码| 亚洲综合精品一区二区三区|