×

# about CAMPON problem of December Cook-Off 2018 Division 2

Hey I am getting successfully executed for the "CAMPON" problem in online compiler of codechef. But when I am trying to submit the code, at that time it is giving Wrong Answer. But my answer is correct. Please help me..........

Here is my Code for CAMPON problem of December Cook-Off 2018 Division 2:

# include<iostream>

using namespace std;

int T, D, Q;

bool camp_or_not(int d, int p, int dead, int req){ int sum = 0; bool res = false;

for(int i=0;i<D;i++){
sum += p[i];
if(sum >= req) return true;
}
}
return false;


} int main(){

//int T, D, Q;
cin>>T;
while(T--){
cin>>D;
int d[D], p[D];
for(int i=0;i<D;i++){
cin>>d[i]>>p[i];
}
cin>>Q;
for(int i=0;i<Q;i++){
int res = camp_or_not(d, p, dead[i], req[i]);
if(res) cout<<"Go Camp\n";
else cout<<"Go Sleep\n";
}

}

return 0;


}

1
accept rate: 0%

 0 Here's your solution which passes all the test cases with some minor modifications made by me. I'd encourage you to spot the mistakes by yourself or if you are stuck, look at your AC solution for hints. https://www.codechef.com/viewsolution/22075184 answered 24 Dec '18, 17:29 106●3 accept rate: 13%
 0 @ashishnar_123 i think you should do like this if(dead>=d[i)..... answered 24 Dec '18, 22:02 1 accept rate: 0%
 0 I am facing same issue, I am new to codecheff, so m not really familiar with how testing here works. But I feel pretty sure about my code, any help would be appreciated. #include using namespace std; #define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define ull unsigned long long int main() { SPEED; int t; cin>>t; while(t--) { int n, d ,p, q, d1, p1, prev = 0; cin>>n; vector ded; int probs[n]; for(int i = 0; i < n; i++) { cin>>d>>p; ded.push_back(d); probs[i] = p + prev; prev = probs[i]; } cin>>q; while(q--) { cin>>d1>>p1; int index = lower_bound(ded.begin(), ded.end(), d1) - ded.begin(); if(ded[index] != d1) index--; //cout<
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

question asked: 24 Dec '18, 11:25

question was seen: 210 times

last updated: 26 Dec '18, 08:08