結果
問題 |
No.3110 Like CPCTF?
|
ユーザー |
|
提出日時 | 2025-04-19 00:11:36 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 77 ms / 2,000 ms |
コード長 | 891 bytes |
コンパイル時間 | 102 ms |
コンパイル使用メモリ | 12,032 KB |
実行使用メモリ | 10,240 KB |
最終ジャッジ日時 | 2025-04-19 00:11:38 |
合計ジャッジ時間 | 1,535 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
n = int(input()) s = input().strip() count = 0 # We need to select 5 distinct indices i1 < i2 < i3 < i4 < i5 in the string s # such that s[i1] == s[i3], and all other characters (s[i2], s[i4], s[i5]) are distinct and != s[i1] for i1 in range(n): for i2 in range(i1 + 1, n): for i3 in range(i2 + 1, n): for i4 in range(i3 + 1, n): for i5 in range(i4 + 1, n): # Check if s[i1] == s[i3] if s[i1] == s[i3]: # Check other conditions a, b, c, d, e = s[i1], s[i2], s[i3], s[i4], s[i5] # a == c is already true # b, d, e must be distinct and != a if b != a and d != a and e != a: if b != d and b != e and d != e: count += 1 print(count)