Show all threads Hide all threads Show all messages Hide all messages |
WA5 . Where is mistake? | Lev_Kireenko 🐬 | 2015. Zhenya moves from the dormitory | 13 Dec 2022 02:57 | 2 |
cost, fun1, fun2 = map(int,input().split()) fri, flat2 = [], [] for i in range(int(input())): fri.append(list(map(int,input().split())))
temp1, temp2 = [-1,-1], [-1, -1, -1] #веселье, квартрира, сосед for i in range(int(input())) : a, b, c = map(int,input().split()) if a == 2 : flat2.append([b,c,i+1]) # стоимость, веселье, номер if fun1 + c > temp1[0] and cost >= b : temp1 = [fun1+c, i+1]
for i in range(len(flat2)) : b, c, k = flat2[i][0], flat2[i][1], flat2[i][2] for j in range(len(fri)) : if fri[j][0] >= b/2 and cost >= b/2 and fun2+fri[j][1]+c > temp2[0] : temp2 = [fun2+fri[j][1]+c, j+1, k] if temp1[0] == -1 and temp2[0] == -1 : print('Forget about apartments. Live in the dormitory.') elif temp1[0] > temp2[0] : print('You should rent the apartment #'+str(temp1[1])+ ' alone.') else : print('You should rent the apartment #'+str(temp2[2])+' with the friend #'+str(temp2[1])+'.') Edited by author 16.09.2016 21:53 fun2 is when you live alone, so you can't add fun2 when living with a friend |
If you have WA5 | SeresHotes | 2015. Zhenya moves from the dormitory | 10 Jan 2022 14:10 | 1 |
Try to reread the task. I've been adding up wrong numbers together because of the misunderstanding. Also, try tests from "If you have WA6" |
No subject | James Gregory | 2015. Zhenya moves from the dormitory | 25 Oct 2017 07:08 | 1 |
Edited by author 25.10.2017 07:16 |
If you have WA6 | Human | 2015. Zhenya moves from the dormitory | 3 Jul 2017 14:38 | 1 |
98000 3334 3334 1 25000 3333 3 1 97999 1 2 30000 1 2 25000 1 Answer - You should rent the apartment #1 alone. or You should rent the apartment #2 alone. or You should rent the apartment #3 alone. 21111 1111 7777 5 1111 7777 10000 6556 20000 3131 80000 2 76400 1 4 1 21110 6000 1 21111 6665 2 21111 1220 2 1110 0 Answer - You should rent the apartment #3 alone. 1001 1001 1001 1 1001 1 1 2 1001 1 Answer - You should rent the apartment #1 alone. I hope it can help. My program, which got WA 6, failed on this tests. |
Why WA4? | Ivan11Start | 2015. Zhenya moves from the dormitory | 27 Jul 2016 17:20 | 3 |
Please, give me some tests. I can't understand why i get WA4. Please make sure your solution meet the requirement "If two people share an apartment, each pays half of the rent." This is that I missed in my first solution. I did this, but it's still WA4. |
wA5 | Shohruh | 2015. Zhenya moves from the dormitory | 8 Jan 2016 22:55 | 2 |
wA5 Shohruh 2 Nov 2014 21:24 Chto za xren Test 5? Does anybody know what the hell is Test 5? Check if you comparing right prices for 2-rooms apartment when person lives single. |
WA16 | watashi | 2015. Zhenya moves from the dormitory | 6 Jun 2015 15:53 | 1 |
WA16 watashi 6 Jun 2015 15:53 Try this test: 1 0 0 0 1 1 1 0 Answer: You should rent the apartment #1 alone. |
WA4 | Amandosov | 2015. Zhenya moves from the dormitory | 29 Nov 2014 15:07 | 1 |
WA4 Amandosov 29 Nov 2014 15:07 Please give me some tests this is my code: #include <iostream> using namespace std; int main() { long sj,prj1,prj2,n,k,sd[256],prd[256],kom[256],sh[256],prh[256]; cin>>sj>>prj1>>prj2>>n; for(int i=0;i<n;i++) cin>>sd[i]>>prd[i]; cin>>k; for(int i=0;i<k;i++) cin>>kom[i]>>sh[i]>>prh[i];
long max=-1,nh=0,nd=0;
for(int i=0;i<k;i++) if(kom[i]==1) { if(sh[i]<=sj&&(prj1+prh[i]>max)) {max=prj1+prh[i];nh=i+1;nd=0;}} else { if(sh[i]<=sj&&(prj2+prh[i]>max)) {max=prj2+prh[i];nh=i+1;nd=0;} for(int j=0;j<n;j++) if(sh[i]<=int(double(sj)/2.0+double(sd[j])/2.0)&&(prh[i]+prd[j]>max)) {max=prh[i]+prd[j];nh=i+1;nd=j+1;} }
if(nd==0) {if(nh==0) cout<<"Forget about apartments. Live in the dormitory."<<endl; else cout<<"You should rent the apartment #"<<nh<<" alone."<<endl; } else cout<<"You should rent the apartment #"<<nh<<" with the friend #"<<nd<<"."<<endl;
return 0; } Edited by author 29.11.2014 15:08 |
Нечётная стоимость | LDV Soft | 2015. Zhenya moves from the dormitory | 28 Nov 2014 01:41 | 3 |
Если двухкомнатная квартира стоит нечётную стоимость, как делится её цена? As like as for even cost. Если была стоимость 5, то каждый платит по 2,5. Если бы делилось как четное, то будет WA18 - проверено. Так что считайте, что могут не целые числа. Edited by author 28.11.2014 01:41 Edited by author 28.11.2014 01:41 |
WA 5 | KOTMAKRUS | 2015. Zhenya moves from the dormitory | 12 Nov 2014 19:49 | 4 |
WA 5 KOTMAKRUS 15 Oct 2014 12:32 Give me some tests please Not related to WA5, but to WA4 - perhaps it helps anyway: I got wa4 when forgot to add the advantage of each apartment, to the total value, before comparing to current max. Re: WA 5 SButterfly [Samara SAU] 8 Nov 2014 23:33 I got WA5. But I have passed it. My error was in copypast. When I was comparing current maximum, I used wrong massive. I want to calculate maximum living along in 2 bedroom apartment massive , but I took values from one bedroom apartment massive :( |