Artifact 824929308b649ea7a1e741a9d8b65f1970b3b31b
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <tuple>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;
class Decipherability { public:
string check(string s, int K)
{
return has_unique_ans(s, s.size()-K) ? "Certain" : "Uncertain";
}
bool has_unique_ans(const string& s, int R)
{
if(R == 0)
return true;
for(int a=0; a<s.size(); ++a)
for(int b=a+1; b<s.size(); ++b) if(s[a] == s[b]) {
if(a + 1 + (s.size()-b-1) >= R)
return false;
}
return true;
}
};
// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
{ ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
{ os << "{ ";
for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const string& Expected, const string& Received) {
bool ok = (Expected == Received);
if(ok) cerr << "PASSED" << timer() << endl; else { cerr << "FAILED" << timer() << endl;
cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END verify_case(_, Decipherability().check(s, K));}
int main(){
CASE(0)
string s = "snuke";
int K = 2;
string _ = "Certain";
END
CASE(1)
string s = "aba";
int K = 1;
string _ = "Certain";
END
CASE(2)
string s = "aba";
int K = 2;
string _ = "Uncertain";
END
CASE(3)
string s = "abcdabcd";
int K = 3;
string _ = "Certain";
END
CASE(4)
string s = "koukyoukoukokukikou";
int K = 2;
string _ = "Uncertain";
END
CASE(5)
string s = "wolfsothe";
int K = 8;
string _ = "Uncertain";
END
CASE(6)
string s = "aa";
int K = 2;
string _ = "Certain";
END
/*
CASE(7)
string s = ;
int K = ;
string _ = ;
END
CASE(8)
string s = ;
int K = ;
string _ = ;
END
*/
}
// END CUT HERE