結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
バカらっく
|
| 提出日時 | 2018-02-18 15:54:32 |
| 言語 | Swift (6.0.3) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 609 bytes |
| コンパイル時間 | 1,580 ms |
| コンパイル使用メモリ | 137,664 KB |
| 実行使用メモリ | 9,344 KB |
| 最終ジャッジ日時 | 2024-11-30 11:52:24 |
| 合計ジャッジ時間 | 2,890 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 12 WA * 10 |
コンパイルメッセージ
Main.swift:4:9: warning: variable 'initStr' was never mutated; consider changing to 'let' constant
var initStr:[String] = [
~~~ ^
let
ソースコード
//: Playground - noun: a place where people can play
func makeReadLineMethod()->()->String? {
var initStr:[String] = [
"4",
"0 1 1 0"
]
var idx = -1;
func proc()->String? {
idx+=1
return initStr[idx];
}
return proc;
}
var readLine = makeReadLineMethod();
let pointCount = Int(readLine()!);
let points = readLine()!.split(separator: " ").map({Int($0)!}).sorted(by: {$0<$1});
var ans = abs(points.first!-points.last!);
for i in 1...points.count-1 {
let tmp = points[i]-points[i-1];
if(tmp>0) {
ans=min(ans, tmp);
}
}
print(ans);
バカらっく