hiho week 18 register

Ended

Participants:468

Verdict:Accepted
Score:100 / 100
Submitted:2014-11-02 19:37:08

Lang:GCC

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<stdio.h>
int weight[20005];
int getmin(int l,int r)
{
    int min,i;
    for(min=20000,i=l;i<=r;i++)
        if(weight[i]<min)
            min=weight[i];
    return min;
}
main()
{
    int n,i,pro,type,x,y;
    scanf("%d",&n);
        for(i=1;i<=n;i++)
            scanf("%d",&weight[i]);
        scanf("%d",&pro);
        while(pro--)
        {
            scanf("%d%d%d",&type,&x,&y);
            if(type==0)
            {
                printf("%d\n",getmin(x,y));
                continue;
            }
            else
                weight[x]=y;
        }
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX