Takahashi wants to buy the popular video game console called Play Snuke.
There are shops that sell Play Snuke: Shop . Shop is minutes' walk from where Takahashi is now, sells Play Snuke for yen (Japanese currency), and currently has Play Snukes in stock.
Now, Takahashi will go to one of those shops on foot and buy Play Snuke if it is still in stock when he gets there.
However, Play Snuke is so popular that the number of consoles in stock (if any) in every shop will decrease by at the following moments: minutes from now.
Determine whether Takahashi can buy Play Snuke. If he can, find the minimum amount of money needed to buy one.\(N\)\(1, 2, \dots, N\)\(i\)\(A_i\)\(P_i\)\(X_i\)\(1\)\(0.5, 1.5, 2.5, \dots\)
#include<stdio.h>
int main()
{
int a[10000][3]={0},b[10000]={0},x=0,j=0,n,i,m;
scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%d%d%d",&a[i][0],&a[i][1],&a[i][2]);}
for(i=0;i<n;i++)
{
if(a[i][0]>=a[i][2])
{x++;}
else{
b[j]=a[i][1];
j++;
}}
if(x==n)
{printf("-1");}
else
{
m=b[0];
for(i=0;i<j;i++)
{
if(m>b[j])
m=b[j];
}
printf("%d",m);
}
}