제출 #615517

#제출 시각아이디문제언어결과실행 시간메모리
615517ShithilaCombo (IOI18_combo)C++14
0 / 100
1 ms208 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
std::string guess_sequence(int N) {
  std::string p = "";
  int len=0;
  string letter=("A","B","X","Y");
  int first=3;
  for(int i=0;i<3;i++)
  {
  	string pas=p+letter[i];
  	if(press(pas)==1)
  	{
  		first=i;
  		p=pas;
  		break;
	}
  }
  if(first==3) p=p+letter[3];
  for(int j=1;j<N;j++)
  {
  	if(first==3)
  	{
  		int second=2;
  for(int i=0;i<2;i++)
  {
  	string pas=p+letter[i];
  	if(press(pas)==j+1)
  	{
  		second=i;
  		p=pas;
  		break;
	}
  }
  if(second==2) p=p+letter[2];
	}
	else
  	{
  		int second=first+1;
  for(int i=0;i<second;i++)
  {
  	string pas=p+letter[i];
  	if(press(pas)==j+1)
  	{
  		second=i;
  		p=pas;
  		break;
	}
  }
  for(int i=second+1;i<3;i++)
  {
  	string pas=p+letter[i];
  	if(press(pas)==j+1)
  	{
  		second=i;
  		p=pas;
  		break;
	}
  }
  if(second==first+1) p=p+letter[first+1];
	}
  }
  return p;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:18: warning: left operand of comma operator has no effect [-Wunused-value]
    7 |   string letter=("A","B","X","Y");
      |                  ^~~
combo.cpp:7:26: warning: right operand of comma operator has no effect [-Wunused-value]
    7 |   string letter=("A","B","X","Y");
      |                          ^~~
combo.cpp:7:30: warning: right operand of comma operator has no effect [-Wunused-value]
    7 |   string letter=("A","B","X","Y");
      |                              ^~~
combo.cpp:6:7: warning: unused variable 'len' [-Wunused-variable]
    6 |   int len=0;
      |       ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...