Good Bye 2019 D. Strange Device

Topic Source: http://codeforces.com/contest/1270/problem/D

Interactive title record it, did not feel anything ....., reverse the input and output.

Meaning of the questions: k each gave different locations, to find a large number of m, allows you to enter the index number and value, m is the number to find this on the line.

Analysis of several real column, after a good first sort found a large number of m + 1 appears m times, m-th greatest appearance km times, discover directly to the largest number of records can be. The sample also have significant implications. Get by i, j special sort of test methods.

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    map<int,int>hh;
    int n,k,i,j;
    cin>>n>>k;
    for(i=1;i<=k+1;i++)
    {
        printf("? ");
        for(j=1;j<=k+1;j++)
        {
            if(i==j)
                continue;
            else{
                printf("%d ",j);
            }
        }         printf("\n");
        int x1,x2;
        cin>>x1>>x2;
        hh[x2]++;
        cout.flush();
    }
    printf("! %d",hh.rbegin()->second);
    return 0;
}

 

Published 56 original articles · won praise 17 · views 2316

Guess you like

Origin blog.csdn.net/weixin_43958964/article/details/103802189
Recommended