Submission #3244561


Source Code Expand

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"math"
	"os"
)

type IOTp struct {
	iBuffer []byte
	iPos int
}
func (this *IOTp) GetChar() byte {
	res:=this.iBuffer[this.iPos]
	this.iPos++
	return res
}
func (this *IOTp) ReadInt() int {
	res:=0
	k:=1
	for ch:=this.iBuffer[this.iPos]; !(ch>='0' && ch<='9'); ch=this.iBuffer[this.iPos]{
		if ch=='-' {
			k=-1
		}
		this.iPos++
	}
	for ch:=this.iBuffer[this.iPos]; ch>='0' && ch<='9'; ch=this.iBuffer[this.iPos]{
		res=res*10+int(ch-'0')
		this.iPos++
	}
	res*=k
	return res
}
func NewIOTp() *IOTp {
	now:=new(IOTp)
	//inputFile,_:=os.Open("in.txt")
	inputFile:=os.Stdin
	now.iBuffer,_=ioutil.ReadAll(inputFile)
	now.iBuffer=append(now.iBuffer, '\n')
	now.iPos=0
	return now
}
var cin *bufio.Reader
var cout *bufio.Writer
func min(a,b int) int {
	if a<=b {
		return a
	} else {
		return b
	}
}
func max(a,b int) int {
	if a>=b {
		return a
	} else {
		return b
	}
}
func gcd(a,b int) int {
	for b!=0 {
		a,b=b,a%b
	}
	return a
}
func abs(x int) int {
	if x>=0 {
		return x
	} else {
		return -x
	}
}
func main() {
	IO:=NewIOTp()
	cout=bufio.NewWriter(os.Stdout)
	n,m:=IO.ReadInt(),IO.ReadInt()
	const MAXN=300
	var a [MAXN+10][MAXN+10]int
	for i:=1; i<=n; i++ {
		for j:=1; j<=m; j++ {
			a[i][j]=IO.ReadInt()
		}
	}
	var b [MAXN+10]bool
	var c [MAXN+10]int
	ans:=math.MaxInt64
	for i:=range b {
		b[i]=true
	}
	for i:=1; i<=m; i++ {
		for j:=range c{
			c[j]=0
		}
		for j:=1; j<=n; j++ {
			for k:=1; k<=m; k++ {
				if b[a[j][k]] {
					c[a[j][k]]++
					break
				}
			}
		}
		mx:=0
		for j:=1; j<=m; j++ {
			if c[j]>c[mx] {
				mx=j
			}
		}
		ans=min(ans,c[mx])
		b[mx]=false
	}
	fmt.Println(ans)
	cout.Flush()
}

Submission Info

Submission Time
Task B - Sports Festival
User WAAutoMaton2
Language Go (1.6)
Score 700
Code Size 1788 Byte
Status AC
Exec Time 32 ms
Memory 2432 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 700 / 700
Status
AC × 3
AC × 24
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt
Case Name Status Exec Time Memory
sample_01.txt AC 2 ms 1408 KB
sample_02.txt AC 2 ms 1408 KB
sample_03.txt AC 2 ms 1408 KB
subtask_1_01.txt AC 2 ms 1408 KB
subtask_1_02.txt AC 2 ms 1408 KB
subtask_1_03.txt AC 2 ms 1408 KB
subtask_1_04.txt AC 2 ms 1408 KB
subtask_1_05.txt AC 2 ms 1408 KB
subtask_1_06.txt AC 3 ms 1664 KB
subtask_1_07.txt AC 5 ms 1664 KB
subtask_1_08.txt AC 2 ms 1408 KB
subtask_1_09.txt AC 2 ms 1408 KB
subtask_1_10.txt AC 2 ms 1536 KB
subtask_1_11.txt AC 6 ms 1536 KB
subtask_1_12.txt AC 2 ms 1408 KB
subtask_1_13.txt AC 4 ms 1664 KB
subtask_1_14.txt AC 6 ms 2432 KB
subtask_1_15.txt AC 26 ms 2432 KB
subtask_1_16.txt AC 9 ms 2432 KB
subtask_1_17.txt AC 12 ms 2432 KB
subtask_1_18.txt AC 32 ms 2432 KB