Submission #53616443
Source Code Expand
// AtCoder Beginner Contest 354
import Foundation
import Collections
let YES = "Yes"
let NO = "No"
func main() {
let n = readInt()
var cards = [(Int, Int, Int)]()
for i in 0..<n {
let (a, c) = read2Ints()
cards.append((i + 1, a, c))
}
cards.sort { $0.2 < $1.2 }
var result = [(Int, Int)]()
var maxA = -1
for card in cards {
let (index, a, c) = card
if a > maxA {
maxA = a
result.append((index, a))
}
}
result.sort { $0.0 < $1.0 }
print(result.count)
print(result.map { String($0.0) }.joined(separator: " "))
}
main()
// MARK: - 入力
// 参考:
// https://github.com/kntkymt/AtCoderBeginnersSelection_Swift
func readInt() -> Int {
return Int(Int64(readLine()!)!)
}
func read2Ints(separator: String.Element = " ") -> (a: Int, b: Int) {
let ints = readLine()!.split(separator: separator).map { Int(String($0))! }
return (a: ints[0], b: ints[1])
}
func read3Ints(separator: String.Element = " ") -> (a: Int, b: Int, c: Int) {
let ints = readLine()!.split(separator: separator).map { Int(String($0))! }
return (a: ints[0], b: ints[1], c: ints[2])
}
func read4Ints(separator: String.Element = " ") -> (a: Int, b: Int, c: Int, d: Int) {
let ints = readLine()!.split(separator: separator).map { Int(String($0))! }
return (a: ints[0], b: ints[1], c: ints[2], d: ints[3])
}
func readInts(separator: String.Element = " ") -> [Int] {
return readLine()!.split(separator: separator).map { Int(String($0))! }
}
func readIntsFromNoSpace() -> [Int] {
return readLine()!.map { Int(String($0))! }
}
func readString() -> String {
return readLine()!
}
func read2Strings(separator: String.Element = " ") -> (a: String, b: String) {
let strings = readLine()!.split(separator: separator).map { String($0) }
return (a: strings[0], b: strings[1])
}
func read3Strings(separator: String.Element = " ") -> (a: String, b: String, c: String) {
let strings = readLine()!.split(separator: separator).map { String($0) }
return (a: strings[0], b: strings[1], c: strings[2])
}
func read4Strings(separator: String.Element = " ") -> (a: String, b: String, c: String, d: String) {
let strings = readLine()!.split(separator: separator).map { String($0) }
return (a: strings[0], b: strings[1], c: strings[2], d: strings[3])
}
func readStrings(separator: String.Element = " ") -> [String] {
return readLine()!.split(separator: separator).map { String($0) }
}
func readStringsFromNoSpace() -> [String] {
return readLine()!.map { String($0) }
}
Submission Info
Submission Time
2024-05-18 21:48:29+0900
Task
C - AtCoder Magics
User
akidon0000
Language
Swift (swift 5.8.1)
Score
350
Code Size
2674 Byte
Status
AC
Exec Time
261 ms
Memory
28616 KiB
Compile Error
[0/1] Planning build
Building for production...
[0/2] Compiling _NumericsShims _NumericsShims.c
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[2/3] Compiling RealModule AlgebraicField.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[4/5] Compiling OrderedCollections _HashTable+Bucket.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[6/7] Compiling DequeModule Compatibility.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[8/9] Compiling Algorithms AdjacentPairs.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[10/11] Compiling Collections Collections.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[12/13] Compiling Main main.swift
/judge/Sources/main.swift:24:22: warning: immutable value 'c' was never used; consider replacing with '_' or removing it
let (index, a, c) = card
^
_
[13/14] Linking Main
Build complete! (10.38s)
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
350 / 350
Status
Set Name
Test Cases
Sample
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_hand_00.txt, 01_hand_01.txt, 01_hand_02.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt
Case Name
Status
Exec Time
Memory
00_sample_00.txt
AC
5 ms
14828 KiB
00_sample_01.txt
AC
5 ms
14844 KiB
00_sample_02.txt
AC
5 ms
14780 KiB
01_hand_00.txt
AC
233 ms
20076 KiB
01_hand_01.txt
AC
261 ms
28616 KiB
01_hand_02.txt
AC
211 ms
23644 KiB
02_random_00.txt
AC
245 ms
20600 KiB
02_random_01.txt
AC
245 ms
21312 KiB
02_random_02.txt
AC
240 ms
21136 KiB
02_random_03.txt
AC
238 ms
21152 KiB
02_random_04.txt
AC
242 ms
21312 KiB
02_random_05.txt
AC
239 ms
20616 KiB
02_random_06.txt
AC
251 ms
21404 KiB
02_random_07.txt
AC
252 ms
21412 KiB
02_random_08.txt
AC
255 ms
21180 KiB
02_random_09.txt
AC
253 ms
21208 KiB
02_random_10.txt
AC
253 ms
21292 KiB