結果

問題 No.216 FAC
ユーザー 💕💖💞💕💖💞
提出日時 2016-09-19 21:04:17
言語 Scala(Beta)
(3.4.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,301 bytes
コンパイル時間 5,002 ms
コンパイル使用メモリ 229,824 KB
最終ジャッジ日時 2024-04-27 02:22:45
合計ジャッジ時間 5,403 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
-- [E040] Syntax Error: Main.scala:11:31 ---------------------------------------
11 |  def main(args: Array[String]){
   |                               ^
   |                               '=' expected, but '{' found
-- [E008] Not Found Error: Main.scala:4:37 -------------------------------------
4 |import scala.collection.mutable.{Map,SynchronizedMap, HashMap}
  |                                     ^^^^^^^^^^^^^^^
  |         value SynchronizedMap is not a member of scala.collection.mutable
2 errors found

ソースコード

diff #

import scala.collection.immutable.Stream
import Math.{sqrt, pow}
import scala.util.control.Breaks
import scala.collection.mutable.{Map,SynchronizedMap, HashMap}
object Main {
  val inf2 = Stream.from(1)
  val inf3 = Stream.continually(1)
  val _lmax  = Long.MaxValue
  val _imax  = Int.MaxValue
  val b1   = new Breaks
  def main(args: Array[String]){
    val n = readLine().toInt
    val points = readLine().split(" ").map { x => x.toInt }.toList
    val whos   = readLine().split(" ").map { x => x.toInt }.toList
    var dmap:Map[Int,Int] = Map()
    points.zip(whos).map { (xs) =>
      val (point, who) = (xs._1, xs._2)
      if (dmap.get(who) == None) 
        dmap = dmap ++ Map(who -> point)
      else
        dmap(who) += point
    }   
    val conved = dmap.map { xs =>  
      val (k, v) = (xs._1, xs._2)
      List(k, v)
    }.toList.sortWith { (a,b) => a(1) > b(1)} 
    val first = conved(0)
    val kkuns = conved.filter { x =>  x(0) == 0 } 
    val others= conved.filter { x =>  x(0) != 0 } 
    if (kkuns.length == 0){ 
      println("NO")
      return
    }   
    if (others.length == 0){ 
      println("YES")
      return
    }   
    val gettable = kkuns(0)(1)
    val maxpoint = others(0)(1)
    if (gettable >= maxpoint) 
      println("YES")
    else
      println("NO")
  }
}
0