結果
| 問題 |
No.2073 Concon Substrings (Swap Version)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-01-10 22:09:09 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 762 bytes |
| コンパイル時間 | 15,198 ms |
| コンパイル使用メモリ | 229,052 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-21 12:22:54 |
| 合計ジャッジ時間 | 14,956 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 WA * 1 |
| other | AC * 8 WA * 29 |
ソースコード
package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
func main() {
sc.Buffer(make([]byte, 1000), 500000)
sc.Split(bufio.ScanWords)
_ = nextInt()
s := nextString()
a := make([][]int, 3)
for i := range a {
a[i] = make([]int, 3)
}
for i := range s {
if s[i] == 'c' {
a[0][i%3]++
}
if s[i] == 'o' {
a[1][i%3]++
}
if s[i] == 'n' {
a[2][i%3]++
}
}
ans := 0
for i := range a {
tmp := a[0][i]
if a[1][(i+1)%3] < tmp {
tmp = a[1][i]
}
if a[2][(i+2)%3] < tmp {
tmp = a[2][i]
}
ans += tmp
}
fmt.Println(ans)
}
func nextInt() int {
sc.Scan()
i, e := strconv.Atoi(sc.Text())
if e != nil {
panic(e)
}
return i
}
func nextString() string {
sc.Scan()
return sc.Text()
}