結果

問題 No.989 N×Mマス計算(K以上)
ユーザー 👑 naipianaipia
提出日時 2020-02-14 21:45:39
言語 Go
(1.21.3)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 1,318 bytes
コンパイル時間 12,086 ms
コンパイル使用メモリ 211,752 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-07-28 17:38:34
合計ジャッジ時間 13,426 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 28 ms
4,376 KB
testcase_11 AC 24 ms
4,380 KB
testcase_12 AC 31 ms
4,380 KB
testcase_13 AC 16 ms
4,380 KB
testcase_14 AC 43 ms
4,376 KB
testcase_15 AC 12 ms
4,376 KB
testcase_16 AC 23 ms
4,376 KB
testcase_17 AC 15 ms
4,376 KB
testcase_18 AC 18 ms
4,376 KB
testcase_19 AC 25 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"sort"
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪( -ω-)ノ ( ・ω・)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1000000)

	n := scanInt()
	m := scanInt()
	k := scanInt()
	op := scanString()

	ans := 0

	b := scanInts(m)
	a := scanInts(n)

	sort.Ints(a)
	sort.Ints(b)
	// fmt.Println(b)

	for i := 0; i < n; i++ {
		var f func(j int) bool
		if op == "+" {
			f = func(j int) bool { return k <= b[j]+a[i] }
		} else {
			f = func(j int) bool { return k <= b[j]*a[i] }
		}
		index := sort.Search(len(b),f)
		ans += m - index
		// fmt.Println(a[i],index)
	}
	

	fmt.Println(ans)
}
0