結果
問題 | No.742 にゃんにゃんにゃん 猫の挨拶 |
ユーザー | tkr182 |
提出日時 | 2018-10-06 01:25:33 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 892 bytes |
コンパイル時間 | 76 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 17,952 KB |
最終ジャッジ日時 | 2024-04-20 18:02:59 |
合計ジャッジ時間 | 7,733 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 29 ms
17,952 KB |
testcase_01 | AC | 27 ms
11,008 KB |
testcase_02 | AC | 30 ms
10,880 KB |
testcase_03 | AC | 31 ms
10,880 KB |
testcase_04 | AC | 36 ms
10,880 KB |
testcase_05 | AC | 66 ms
10,880 KB |
testcase_06 | AC | 179 ms
10,880 KB |
testcase_07 | AC | 707 ms
11,008 KB |
testcase_08 | AC | 2,455 ms
11,136 KB |
testcase_09 | AC | 27 ms
10,880 KB |
testcase_10 | AC | 28 ms
10,880 KB |
testcase_11 | TLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
ソースコード
n=int(input()) t=[int(input()) for i in range(n)] s=[(i,t.index(i)+1) for i in range(1,n+1)] c=0 d=0 for i in range(0,n): for t in range(0,n): if s[i][0]==s[t][1] and s[i][1]==s[t][0] and i!=t: d+=1 for i in range(0,n): if s[i][0]<=s[i][1]: for p in range(0,n): if i!=p: if s[p][0]<=s[p][1]: if s[i][0]<=s[p][0]<=s[p][1]<=s[i][1]: c+=1 elif s[i][0]<=s[p][1]<=s[p][0]<=s[i][1]or s[i][0]<s[p][1]<s[i][1]<s[p][0]: c+=1 else: for p in range(0,n): if i!=p: if s[p][0]<=s[p][1]: if s[i][1]<=s[p][0]<=s[p][1]<=s[i][0]or s[i][1]<s[p][0]<s[i][0]<s[p][1]: c+=1 elif s[i][1]<=s[p][1]<=s[p][0]<=s[i][0]: c+=1 print(int(c-d/2))