https://ide.codingblocks.com/s/45751
my code only one test case is passing
Hey Anshu, you can check this i have just corrected your condition function and apart from that if you read the problem carefully it is mentioned that you are supposed to return the ans % 10000003.
check for test case
2
3
1 10 15
ans should be 16 but your code is giving 15
check this
https://ide.codingblocks.com/s/46158
The code is wrong as well as the test case is also wrong . Please redo the solution
Let me point out the common mistakes people may do;
why do we take start pointer to max_element and end pointer to sum_elements ??
hey ! so here we have 3 painters that means 1 will paint 10 unit another will paint the 15 unit so total time will be 15 .So , how come the answer is 16.
#include
#include
#define ll long long
#define mod 10000003
using namespace std;
int main()
{
ll n,k,t;
cin>>n>>k>>t;
ll arr[n];
for(ll i = 0 ; i < n ;i++)
{
cin>>arr[i];
arr[i] = (arr[i]*t)%mod;
}
sort(arr, arr+n,greater<int>());
long long ans = 0 ;
for(ll i = 0 ; i < n ;i += k )
{
ans +=arr[i];
ans %=mod;
}
cout<<ans;
}
please help me where i am wrong?