Submission #147524

# Submission time Handle Problem Language Result Execution time Memory
147524 2019-08-30T00:47:00 Z imsifile Get Hundred Points! (FXCUP4_hundred) C++17
Compilation error
0 ms 0 KB
#include "hundred.h"
#include <algorithm>
using namespace std;
 
string bas, tmp; int mms[111], cc[3], fi;
 
string GetHundredPoints(int A, int B, int C) {
	for(int i=0; i<A; i++) bas += 'A';
	for(int i=0; i<B; i++) bas += 'B';
	for(int i=0; i<C; i++) bas += 'C';
	int bsc = Mark(bas);
	if(bsc == 100) return;
 
	for(int i=0; i<100; i++){
		if(bas[0]==bas[i]) continue;
		tmp=bas; swap(tmp[0], tmp[i]);
		int cha = Mark(tmp)-bsc;
		if(!cha) mms[i]=0;
		else if((cha+3)%3==1) mms[i]=(bas[i]-bas[0]+3)%3;
		else mms[i]=(bas[0]-bas[i]+3)%3;
	}
	for(int i=1; i<100; i++){
		if(bas[0]!=bas[i]) break;
		tmp=bas; swap(tmp[i], tmp[99]);
		int cha = Mark(tmp)-bsc;
		if(!cha) mms[i]=mms[99];
		else if((cha+3)%3==1) mms[i]=(mms[99]+bas[i]-bas[99]+3)%3;
		else mms[i]=(mms[99]+bas[99]-bas[i]+3)%3;
	}
	for(int i=0; i<100; i++) cc[mms[i]]++;
	if(cc[0]==A && cc[1]==B) fi=0;
	else if(cc[0]==B && cc[1]==C) fi=1;
	else fi=2;
 
	bas="";
	for(int i=0; i<100; i++) bas+="ABC"[(fi+mms[i])%3];
	return bas;
}

Compilation message

hundred.cpp: In function 'std::__cxx11::string GetHundredPoints(int, int, int)':
hundred.cpp:12:17: error: return-statement with no value, in function returning 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}' [-fpermissive]
  if(bsc == 100) return;
                 ^~~~~~