結果

問題 No.1828 Except 3
ユーザー 8989
提出日時 2022-02-18 02:48:36
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 464 ms / 2,000 ms
コード長 4,059 bytes
コンパイル時間 16,849 ms
コンパイル使用メモリ 438,020 KB
実行使用メモリ 56,452 KB
最終ジャッジ日時 2023-09-11 17:59:29
合計ジャッジ時間 24,523 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 330 ms
52,856 KB
testcase_01 AC 464 ms
56,452 KB
testcase_02 AC 300 ms
52,836 KB
testcase_03 AC 298 ms
52,920 KB
testcase_04 AC 296 ms
53,076 KB
testcase_05 AC 297 ms
52,928 KB
testcase_06 AC 305 ms
53,160 KB
testcase_07 AC 297 ms
52,892 KB
testcase_08 AC 300 ms
53,148 KB
testcase_09 AC 306 ms
52,848 KB
testcase_10 AC 301 ms
53,004 KB
testcase_11 AC 306 ms
53,316 KB
testcase_12 AC 308 ms
52,988 KB
testcase_13 AC 306 ms
53,012 KB
testcase_14 AC 311 ms
52,980 KB
testcase_15 AC 336 ms
53,172 KB
testcase_16 AC 303 ms
52,804 KB
testcase_17 AC 301 ms
52,828 KB
testcase_18 AC 300 ms
53,372 KB
testcase_19 AC 299 ms
53,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*
import kotlin.math.*

fun main() {
    var n = one_To_Int()
    n += 1
    var now = 0
    var a = list_To_Long().map{ x -> x % 3L }.groupBy {it}
        .mapValues { it.value.count() }
    var b = list_To_Long().map{ x -> x % 3L }.groupBy { it }
        .mapValues { it.value.count() }
    var c = list_To_Long().map{ x -> x % 3L }.groupBy { it }
        .mapValues { it.value.count() }
//    println(a)
//    println(b)
//    println(c)
    var res = 1L
    for ((i,j) in a){
        if (i != 0L){
            now += j
        }
    }
    res *= now.toLong()
    now = 0
    for ((i,j) in b){
        if (i != 0L){
            now += j
        }
    }

    res *= now.toLong()
    now = 0
    for ((i,j) in c){
        if (i != 0L){
            now += j
        }
    }
    res *= now.toLong()
    println(res)


}

var mod99:Long = 998244353
var mod10:Long = 1000000007
var modt = 1000000000000L
val reader = System.`in`.bufferedReader()
var inf = 1000000002L

fun init_String_SortedList():SortedSet<String>{
    return init_String_List().toSortedSet<String>()
}
fun init_Int_SortedList():SortedSet<Int>{
    return init_Int_List().toSortedSet<Int>()
}
fun init_Long_SortedList():SortedSet<Long>{
    return init_Long_List().toSortedSet<Long>()
}
fun mod_pow(x:Long, n:Long, p: Long): Long {
    var ans = 1L
    var X: Long = x
    var N: Long = n
    while (N >= 1L) {
        if (N % 2 == 1L) {
            ans *= X
            ans = ans % p
        }
        X *= X
        X = X % p
        N = N / 2
    }
    return ans
}
//fun pow(x:BigInteger, n:BigInteger):BigInteger{
//    var ans = 1.toBigInteger()
//    var X: BigInteger = x
//    var N:BigInteger = n
//    while (N >= 1.toBigInteger()) {
//        if (N % 2 == 1.toBigInteger()) {
//            ans *= X
//
//        }
//        X *= X
//        N = N / 2.toBigInteger()
//    }
//    return ans
//}
fun input():String{
    return reader.readLine()
}
fun init_Long_List():MutableList<Long>{
    var a = MutableList<Long>(0) { 0 }
    return a
}
fun init_String_List():MutableList<String>{
    var a = MutableList<String>(0) { "" }
    return a
}
fun init_Int_List():MutableList<Int>{
    var a = MutableList<Int>(0) { 0 }
    return a
}
fun list_To_Int():MutableList<Int>{
    return input().split(" ").map{it.toInt()}.toMutableList()
}
fun list_To_Long():MutableList<Long>{
    return input().split(" ").map{it.toLong()}.toMutableList()
}
fun one_To_Int():Int{
    return input().toInt()
}
fun one_To_Long():Long {
    return input().toLong()
}
fun one_To_Double():Double {
    return input().toDouble()
}
//fun deque():ArrayDeque<Long>{
//    var queue:ArrayDeque<Long> = ArrayDeque()
//    return queue
//}
fun merge(A:MutableList<Long>,left:Int, mid:Int, right:Int) {
    var n1 = mid - left;
    var n2 = right - mid;
    var L = MutableList<Long>(n1 + 1) { 0 }
    var R = MutableList<Long>(n2 + 1) { 0 }
    for (i in 0..n1 - 1) {
        L[i] = A[left + i]
    }
    for (i  in 0..n2 - 1){
        R[i] = A[mid + i]
    }
    L[n1] = inf
    R[n2] = inf
    var i = 0
    var j = 0
    for (k in left..right - 1) {

        if (L[i] <= R[j]) {
            A[k] = L[i]
            i = i + 1
        }
        else {
            A[k] = R[j]
            j = j + 1
        }
    }
}
fun make_divisor(n:Long):MutableList<Long>{
    var res = init_Long_List()
    var i = 1L
    while (i * i <= n){
        if (n % i == 0L){
            res.add(i)
            if (i*i != n){
                res.add(n/i)
            }
        }
        i += 1
    }
    res.sort()
    res.add(n)
    return res
}
fun Sort(A:MutableList<Long>,left:Int, right:Int){
    if (left+1 < right) {
        var mid = (left + right) / 2;
        Sort(A, left, mid)
        Sort(A, mid, right)
        merge(A, left, mid, right)
    }
}
fun gcd(a :Int ,b:Int):Int{
    if (a % b == 0){
        return b
    }else{
        return gcd(b,a%b)
    }
}
0