結果
| 問題 |
No.1687 What the Heck?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-24 21:59:41 |
| 言語 | Kotlin (2.1.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 900 bytes |
| コンパイル時間 | 12,399 ms |
| コンパイル使用メモリ | 440,232 KB |
| 実行使用メモリ | 81,860 KB |
| 最終ジャッジ日時 | 2024-07-05 10:35:05 |
| 合計ジャッジ時間 | 21,317 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 WA * 10 |
ソースコード
import java.io.PrintWriter
import java.util.*
import kotlin.math.*
fun PrintWriter.solve() {
val n = nextInt()
val a = Array(n) { nextInt() }
val idx = a.indexOf(n) + 1
println(max(0, n * (n + 1L) / 2 - idx * 2))
}
fun main() {
Thread(null, {
val writer = PrintWriter(System.out, false)
writer.solve()
writer.flush()
}, "solve", 1.shl(26))
.apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); kotlin.system.exitProcess(1) } }
.apply { start() }.join()
}
// region Scanner
private var st = StringTokenizer("")
private val br = System.`in`.bufferedReader()
fun next(): String {
while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())
return st.nextToken()
}
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextLine() = br.readLine()
fun nextDouble() = next().toDouble()
// endregion