Submission #592383

#TimeUsernameProblemLanguageResultExecution timeMemory
592383starchanLaugh Analysis (IOI16_laugh)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "laugh.h"
using namespace std;
#define int long long
#define in pair<int, int>
#define f first
#define s second
#define pb push_back
#define pob pop_back
#define INF (int)1e17
#define MX (int)3e5+5
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
string life;
struct fieldtype
{
	int pref, suff, len, sub;
};
fieldtype value(int l, int r)
{
	fieldtype val;
	int m = (l+r)/2;
	if(l==r)
	{
		if(life[m] == 'a' || life[m] == 'h')
		{
			val.pref = 1;
			val.suff = 1;
			val.len = 1;
			val.sub = 1;
		}
		else
		{
			val.pref = 0;
			val.suff = 0;
			val.len = 1;
			val.sub = 0;
		}
		return val;
	}
	fieldtype d1 = value(l, m);
	fieldtype d2 = value(m+1, r);
	val.pref = max(d1.pref, ((d1.pref==d1.len) && (life[m]!=life[m+1]))*(d1.len+d2.pref));
	val.suff = max(d2.suff, ((d2.suff==d2.len) && (life[m]!=life[m+1]))*(d2.len+d1.suff));
	val.len = d1.len+d2.len;
	val.sub = max({d1.sub, d2.sub, (life[m]!=life[m+1])*(d1.suff+d2.pref)});
	return val;
}
int longest_laugh(string s)
{
	life = s;
	return value(0, life.length()-1).sub; 
}

Compilation message (stderr)

laugh.cpp:48:5: error: ambiguating new declaration of 'long long int longest_laugh(std::string)'
   48 | int longest_laugh(string s)
      |     ^~~~~~~~~~~~~
In file included from laugh.cpp:2:
laugh.h:5:5: note: old declaration 'int longest_laugh(std::string)'
    5 | int longest_laugh(std::string s);
      |     ^~~~~~~~~~~~~