結果

問題 No.762 PDCAパス
ユーザー tcltktcltk
提出日時 2021-01-16 11:14:30
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,183 bytes
コンパイル時間 376 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 93,592 KB
最終ジャッジ日時 2023-08-18 07:33:32
合計ジャッジ時間 11,389 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 232 ms
83,516 KB
testcase_01 AC 234 ms
83,320 KB
testcase_02 AC 233 ms
83,324 KB
testcase_03 AC 236 ms
83,136 KB
testcase_04 AC 235 ms
83,488 KB
testcase_05 AC 233 ms
83,364 KB
testcase_06 AC 233 ms
83,136 KB
testcase_07 AC 231 ms
83,372 KB
testcase_08 AC 228 ms
83,372 KB
testcase_09 AC 227 ms
83,288 KB
testcase_10 AC 227 ms
83,136 KB
testcase_11 AC 237 ms
83,224 KB
testcase_12 AC 230 ms
83,348 KB
testcase_13 AC 231 ms
83,404 KB
testcase_14 AC 236 ms
83,244 KB
testcase_15 AC 242 ms
83,532 KB
testcase_16 AC 231 ms
83,140 KB
testcase_17 AC 232 ms
83,316 KB
testcase_18 AC 233 ms
83,308 KB
testcase_19 AC 240 ms
83,200 KB
testcase_20 AC 232 ms
83,288 KB
testcase_21 AC 237 ms
83,076 KB
testcase_22 TLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#region Header
#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
from queue import PriorityQueue
import bisect
import heapq

def input():
    return sys.stdin.readline()[:-1]

sys.setrecursionlimit(1000000)
#endregion

# _INPUT = """# paste here...
# """
# sys.stdin = io.StringIO(_INPUT)

MOD = 1000000007

# def solve(N: int, M: int, S: str, u: List[int], v: List[int]) -> int:
def solve(N, M, S, u, v):
    pass  # TODO: edit here

def main():
    N, M = map(int, input().split())
    S = input()
    G = [list() for _ in range(N)]
    for _ in range(M):
        _u, _v = map(int, input().split())
        G[_u-1].append(_v-1)
        G[_v-1].append(_u-1)

    count = 0
    for i in range(N):
        if S[i] == 'P':
            for j in G[i]:
                if S[j] == 'D':
                    for k in G[j]:
                        if S[k] == 'C':
                            for l in G[k]:
                                if S[l] == 'A':
                                    count += 1
    print(count)

if __name__ == '__main__':
    main()
0