← 返回 stripe 的题目列表Six Degrees of Collusion - Risk Scoring
类型:online_judge
Problem: Risk Scoring and Blocking
Not every connected cluster is malicious. Each transaction log now contains a user, a device, a credit-card hash, and a risk score:
user_id,device_id,credit_card,risk_score
Users are still connected through shared device_id or shared credit_card, forming a Fraud Ring.
Each user has a risk_score in [0, 100]. The same user always has the same risk score across all logs.
If the average risk score of users in the Fraud Ring containing target_user is strictly greater than 75, return the string true; otherwise return false.
Critical Exception: Trusted Users
Users with risk score 0 are trusted users:
They still maintain graph connectivity and may connect otherwise separate groups;
They must be excluded from both the sum and the count when computing the average;
Each unique user is counted only once.
If the target user does not exist, or the target ring has no non-zero-risk users, return false.
Input Format
n
transaction_1
transaction_2
...
transaction_n
target_user
Output Format
Print true or false.
Constraints
0 <= n <= 2 * 10^5
All fields are non-empty strings without commas
0 <= risk_score <= 100
A user may appear multiple times, but their risk score is consistent
Example
Input
3
Alice,D1,CC1,90
Bob,D1,CC2,0
Charlie,D2,CC2,80
Alice
Output
true