제출 #760287

#제출 시각아이디문제언어결과실행 시간메모리
760287TrumlingCombo (IOI18_combo)C++14
컴파일 에러
0 ms0 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 j=0;j<2*N;j++)
      p+=dic[0][0];

    for(int j=0;j<2*N;j++)
      p+=dic[1][0];

    ll ans=press(p);
    pair<int,int>possible;

    if(ans)
    {
      p="";
      for(int j=0;j<4*N;j++)
      p+=dic[0][0];
      ans=press(p);
      if(ans)
        first=0;
      else
      first=1;
    }
    else
    {
      p="";
      for(int j=0;j<4*N;j++)
      p+=dic[2][0];
      ans=press(p);
      if(ans)
      first=2;
      else
      first=3;
    }

    p="";
    for(int i=0;i<4*N;i++)
    p+=dic[first][0];
for(int i=1;i<N-1;i++)
{
  p[i]=dic[(first+1)%4][0];
  for(int j=1;j<=3;j++)
  {
  p[i+j*N]=dic[(first+2)%4][0];
  p[i+j*N+1]=dic[(first+j)%4][0];
  }

  ll ans=press(p);

  if(ans==i+1)
  for(int j=0;j<=3;j++)
  p[i+j*N]=dic[(first+1)%4][0];

  if(ans==i+2)
  for(int j=0;j<=3;j++)
  p[i+j*N]=dic[(first+2)%4][0];

  if(ans==i)
  for(int j=0;j<=3;j++)
  p[i+j*N]=dic[(first+3)%4][0];
}
p[N-1]=dic[(first+1)%4][0];

ll ans=press(p);
if(ans!=N)
{
  p[N-1]=dic[(first+2)%4][0];
  ans=press(p);

  if(ans!=N)
  p[N-1]=dic[(first+3)%4][0];
}
    string answ;
    for(int i=0;i<N;i++)
    answ+=p[i];

    return answ;
}

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:81:4: error: redeclaration of 'll ans'
   81 | ll ans=press(p);
      |    ^~~
combo.cpp:27:8: note: 'll ans' previously declared here
   27 |     ll ans=press(p);
      |        ^~~