Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×
Help in debugging Codechef — Carvans 
Difference between en1 and en2, changed 4 character(s)
Here is the link for the problem with CodeChef problem Carvans.↵
↵
Here's my solution. ... I am unable to find any bugs. Please help me debug it and tell me what is wrong with it. ↵
↵
    #include <stdio.h>↵
    #include <algorithm>↵
↵
    using namespace std;↵
↵
    void solve()↵
    {↵
        int previous_car_speed = 1e9, current_car_speed, number_of_cars, current_car_max_speed;;↵
        scanf("%d", &number_of_cars);↵
↵
       int no_of_cars_at_max_speed = 0;↵
        for(int i = 1; i <= number_of_cars; i++)↵
       {↵
            scanf("%d", &current_car_max_speed);↵
↵
            current_car_speed = min(previous_car_speed, current_car_max_speed);↵
↵
            no_of_cars_at_max_speed += (current_car_speed == current_car_max_speed);↵
↵
            previous_car_speed = current_car_speed;↵
       }↵
↵
       printf("%d\n", no_of_cars_at_max_speed);↵
    }↵
↵
   
  int main()↵
     {↵
        int no_of_test_cases;↵
        scanf("%d", &no_of_test_cases);↵
↵
        while(no_of_test_cases--)↵
            solve();↵
↵
        return 0;↵
    }

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English ghoshsai5000 2017-06-26 05:50:06 45
en2 English ghoshsai5000 2017-06-25 17:27:32 4 Tiny change: ' }\n\n int main()\n {\n ' -> ' }\n\n int main()\n {\n '
en1 English ghoshsai5000 2017-06-25 17:25:52 1090 Initial revision (published)