Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
#include <iostream>
#include <string>
#include <vector>
#include <bits/stdc++.h>
#include <algorithm>
#include <utility>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;
bool check(vector<char>& v1, vector<char>& v2)
{
int n = v1.size();
for (int i = 0; i < n; i++)
{
if (v1[i] != v2[i])
{
return false;
}
}
return true;
}
int main() {
// your code goes here
int n;
cin >> n;
vector<vector<char>> comp;
for (int i = 0; i < n; i++)
{
vector<char> temp(n);
int tcoun = 0;
for (int j = 0; j < n; j++)
{
cin >> temp[j];
}
comp.push_back(temp);
}
map < vector<char> , int> mp;
for (int i = 0; i < n; i++)
{
mp[comp[i]]++;
}
int res = 0;
for (auto it = mp.begin(); it != mp.end(); it++)
{
if (it->second > res)
{
int countT = 0;
for (auto x : it->first)
{
if (x == 'T')
{
countT++;
}
}
if (countT == it->second)
{
res = it->second;
}
}
}
cout << res << endl;
return 0;
}
# cook your dish here
# cook your dish here
n = int(input())
l = []
for i in range(n):
a = input().split()
l.append(a)
c = 0
for i in range(n):
f = 0
v = l[i].count('T')
for j in range(n):
if l[i][j] == 'T' and i != j:
if l[i] == l[j]:
continue
else:
f = 1
break
if f == 0 and c < v:
c = v
print(c)
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int n,t,i,j,k,l,sum,k1;
scanf("%d",&n);
l=2*n+1;
char s[n+1][l];
scanf("\n");
for(i=0;i<n;i++){
gets(s[i]);
}
sum=0;
for(i=0;i<n;i++){
k=0;
k1=0;
for(j=0;j<n;j++){
if(s[i][2*j]=='T'){
if(strcmp(s[i],s[j])!=0){
k1=1;
break;
}
else{
k++;
}
}
}
if(k1==0){
sum=sum+k;
break;
}
}
printf("%d\n",sum);
}
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
FastReader fr;
void solve() throws Exception
{
int n=ni();
ArrayList<ArrayList<String>> mat=new ArrayList<ArrayList<String>>(1010);
int i,j,k;
for(i=0;i<1010;i++)
mat.add(new ArrayList<String>());
TreeMap<String,Integer> m1=new TreeMap<String,Integer>();
for(i=0;i<n;i++)
{
String dt="";
for(j=0;j<n;j++)
{
String mp=ns();
dt=dt+mp;
}
if(m1.containsKey(dt))
{
int fgt=m1.get(dt);
m1.put(dt,fgt+1);
}
else
{
m1.put(dt,1);
}
}
for(Map.Entry<String,Integer> e: m1.entrySet())
{
String fr=(String)e.getKey();
int val=(int)e.getValue();
mat.get(val).add(fr);
}
int c;
for(i=1005;i>=0;i--)
{
c=0;
for(j=0;j<mat.get(i).size();j++)
{
String hg=mat.get(i).get(j);
c=0;
for(k=0;k<hg.length();k++)
{
if(hg.charAt(k)=='T')
c++;
}
if(mat.get(i).size()>0 && c==i)
{
System.out.println(i);
return ;
}
}
}
System.out.println("0");
return ;
}
void run() throws Exception
{
fr=new FastReader();
solve();
}
int ni() throws Exception
{
return Integer.parseInt(fr.next());
}
String ns() throws Exception
{
return fr.next();
}
class FastReader
{
BufferedReader br;
StringTokenizer str;
public FastReader()
{
br=new BufferedReader(new InputStreamReader(System.in));
}
String next() throws Exception
{
while(str==null || str.hasMoreElements()==false)
{
try
{
str=new StringTokenizer(br.readLine());
}
catch(Exception ee)
{
}
}
return str.nextToken();
}
}
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
try
{
new Codechef().run();
}
catch(Exception ee)
{
}
}
}
n = int(input())
a = []
for i in range(n):
s = input().split(" ")
d = ""
for c in s:
d = d + c;
a.append(d)
ans = 0
for i in range(n):
temp = 0
for j in range(n):
# print(i,j,a[i] == a[j])
if a[i][j] == 'T':
if a[i] == a[j]:
temp += 1
else:
temp = 0
break
else:
if a[i] == a[j]:
temp = 0
break
# print(temp)
ans = max(temp,ans)
print(ans)
# cook your code here
testCases=input()
answers=[]
for i in range (testCases):
a=raw_input().split()
answers.append(a)
# print(answers)
# for i in range(len(answers)):
# print(answers[i])
count = 0
for i in range(testCases):
flag = 0
ans=answers[i].count('T')
for j in range (testCases):
if answers[i][j] =='T' and i!=j :
if answers[i] == answers [j]:
continue
else:
flag=1
break
if flag==0 and count<ans:
count=ans
print(count)
package main
import (
"bufio"
"fmt"
"os"
)
func readInt(bytes []byte, from int, val *int) int {
i := from
sign := 1
if bytes[i] == '-' {
sign = -1
i++
}
tmp := 0
for i < len(bytes) && bytes[i] != ' ' {
tmp = tmp*10 + int(bytes[i]-'0')
i++
}
*val = tmp * sign
return i
}
func readNum(scanner *bufio.Scanner) (a int) {
scanner.Scan()
readInt(scanner.Bytes(), 0, &a)
return
}
func readTwoNums(scanner *bufio.Scanner) (a int, b int) {
res := readNNums(scanner, 2)
a, b = res[0], res[1]
return
}
func readNNums(scanner *bufio.Scanner, n int) []int {
res := make([]int, n)
x := 0
scanner.Scan()
for i := 0; i < n; i++ {
for x < len(scanner.Bytes()) && scanner.Bytes()[x] == ' ' {
x++
}
x = readInt(scanner.Bytes(), x, &res[i])
}
return res
}
func fillNNums(scanner *bufio.Scanner, n int, res []int) {
x := 0
scanner.Scan()
for i := 0; i < n; i++ {
for x < len(scanner.Bytes()) && scanner.Bytes()[x] == ' ' {
x++
}
x = readInt(scanner.Bytes(), x, &res[i])
}
}
func readUint64(bytes []byte, from int, val *uint64) int {
i := from
var tmp uint64
for i < len(bytes) && bytes[i] != ' ' {
tmp = tmp*10 + uint64(bytes[i]-'0')
i++
}
*val = tmp
return i
}
func main() {
scanner := bufio.NewScanner(os.Stdin)
n := readNum(scanner)
S := make([]string, n)
for i := 0; i < n; i++ {
for len(S[i]) == 0 {
scanner.Scan()
S[i] = compress(scanner.Bytes())
}
}
//fmt.Fprintf(os.Stderr, "%v\n", S)
fmt.Println(solve(S))
}
func compress(bs []byte) string {
var i = 0
var j = 0
for j < len(bs) {
if bs[j] == 'T' || bs[j] == 'F' {
bs[i] = bs[j]
i++
}
j++
}
return string(bs[:i])
}
func solve(S []string) int {
n := len(S)
cnt := make(map[string]int)
for i := 0; i < n; i++ {
cnt[S[i]]++
}
var res int
for k, v := range cnt {
if v <= res {
continue
}
var x int
for i := 0; i < len(k); i++ {
if k[i] == 'T' {
x++
}
}
if x == v {
res = max(res, v)
}
}
return res
}
func max(a, b int) int {
if a >= b {
return a
}
return b
}
In our experience, we suggest you solve this Return of the Gargoyle King CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
If you are stuck anywhere between any coding problem, just visit Queslers to get the Return of the Gargoyle King CodeChef Solution.
I hope this Return of the Gargoyle King CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.
This Problem is intended for audiences of all experiences who are interested in learning about Programming Language in a business context; there are no prerequisites.
Keep Learning!