Submission #759314

#TimeUsernameProblemLanguageResultExecution timeMemory
759314TrumlingCombo (IOI18_combo)C++14
10 / 100
56 ms564 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std; 

typedef long long ll;
#define pb push_back
#define F first
#define S second
#define enter cout<<'\n';
#define INF 99999999999999999
#define MOD 1000000007
#define all(x) x.begin(),x.end()

string guess_sequence(int N) 
{
  string dic[4]={"A","B","X","Y"};

  ll first=-1;
  string p;
  for(int i=0;i<4;i++)
  {
    p="";
    for(int j=0;j<4*N;j++)
    {
      p+=dic[i];
    }
    ll ans=press(p);
    if(ans)
    {
      first =i;
      break;
    }
  }

  if(N==1)
  return dic[first];
for(int j=1;j<N;j++)
  for(int i=0;i<4;i++)
  {
    if(i==first)
    continue;

    p[j]=dic[i][0];

    ll ans=press(p);
    if(ans==j+1)
    break;
  }

  string ans;
  for(int i=0;i<N;i++)
  ans+=p[i];

  return ans;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:37:1: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   37 | for(int j=1;j<N;j++)
      | ^~~
combo.cpp:50:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   50 |   string ans;
      |   ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...