1 solutions

  • 0
    @ 2025-11-5 16:40:35

    C++ :

    #include<iostream>
    #include<algorithm>
    using namespace std;
    
    const int N = 51;
    int available[N], number[N];
    
    int main()
    {
    	int n, k, p;
    	int i, color, money;
    	long long ans = 0;
    	
    	cin >> n >> k >> p;
    	for (i = 1; i <= n; i++)
    	{
    		cin >> color >> money;
    		if (money <= p) copy(number, number + N, available);
    		ans += available[color];
    		if (money <= p) available[color]++;
    		number[color]++;
    	}
    	
    	cout << ans << endl;
    	
    	return 0;
    }
    
    
    • 1

    Information

    ID
    17924
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By