Общий форумUse scanline y = -x + a We need to use no more than 6 points If you want to be fast use k-statistic in O(n) For better explanation write here: myironmistake@gmail.com Edited by author 06.08.2019 18:42 Even though it took me almost 2 hours to solve I'm surprised this has difficulty of 1539. It doesn't require any special knowledge and almost anyone can solve this. Solution is pretty straightforward. Anyone can give me this test case? DELETED Edited by author 04.08.2019 22:55 Dear admin: Please add this test: 3 2 4 6 2 1 7 8 I got tle on this test.But fortunately I got AC! My AC solution outputs "YES" on that test case. My two AC submissions give different answers on this test: 3 4 0 0 0 0 6 1 5 5 2 8 5 3 P.S. The first test case isn't the sample. Edited by author 19.11.2013 01:26 My AC solution outputs "NO" on that test case. I WAed many many times, and finally got AC. Test6 is 0, whose answer is 2. Test 7 is probably 1 or 2, which my previous program had given incorrect answer to. The answer to Test 8 has to be 36, because I used "for(i=x;i<36;i++)" and wa8. (I also saw some prog posted on this forum had the same problem) When I found this and changed into "<=", AC at last. Sorry for my poor English. Hope these can help you guys somehow. Good luck! Thank to your help. Sorry for my poor English,too. Thank you, your hints helped me to get AC. I got Crash (integer division by zero) before. unfortunately, it didn't help me :( still get WA8, any ideas?? I WAed many many times, and finally got AC. Test6 is 0, whose answer is 2. Test 7 is probably 1 or 2, which my previous program had given incorrect answer to. The answer to Test 8 has to be 36, because I used "for(i=x;i<36;i++)" and wa8. (I also saw some prog posted on this forum had the same problem) When I found this and changed into "<=", AC at last. Sorry for my poor English. Hope these can help you guys somehow. Good luck! Thanks... Thanks, my program went in cycle to 35 instead of 36) Hi, why is a problem author talking about bubble sort? And why a lot using stl stable_sort? Where is a differents of stl sort? In this test N=50 and the answer is 1069. I spent about an hour till i figured out that: If it is impossible to get from the computer to the refrigerator, you should output 0 0. !!!! Thank u so much! How should I forget this! i really don't understand why i got WA #1...i try a lot of tests and i always have the right answer, could anyone give me test 1, please, thx~ Edited by author 26.04.2012 11:47 Edited by author 26.04.2012 11:48 #include<bits/stdc++.h> using namespace std; int main(){ long long a[10],l,s,z=1,q,f; vector<long long>v; vector<long long>p; bool prime[10000]; memset(prime,true,sizeof(prime)); for(int i=2;i<=10000;i++){ if(prime[i]){ for(int j=i*2;j<=10000;j=j+i){ prime[j]=false; } } } for(int i=2;i<=10000;i++){ if(prime[i]){ v.push_back(i); } } q=v.size(); f=v[q-1]; for(int i=2;i<=f;i++){ p.push_back(0); } for(int j=0;j<10;j++){ cin>>a[j]; } for(int i=0;i<10;i++){ l=0,s=0; while(a[i]>=v[l]){ if(a[i]%v[l]==0){ //cout<<a[i]<<" "<<v[l]<<endl; p[v[l]]++; a[i]=a[i]/v[l]; } else{ l++; } } } for(int i=0;i<=p.size();i++){ z=(z*(p[i]+1))%10000; } z=z%10; cout<<z; return 0; } If you have WA #9 try this: 4 1 1 32300 0 * 1 1 32300 0 * 1 1 32300 0 * 1 1 32300 0 answer: 129200 a=int(raw_input()) count=2 for i in range(0,a): b=str(raw_input()) if b[-4]=='+': count+=2 else: count+=1 if count==13: count+=1 print(count*100) solved! Since the problem says names consist of Latin letters (donno if + is used in Latin names), so string matching must include '+one' rather '+' so after correction of if b[-4]=='+': to if b[-4:]=='+one': it got accepted I really appreciate your help guys, please give a test, I spend so much time to solve this problem, now I don't wanna leave it like that. Now I have WA23, any ideas? Если вы отсекли тарелки (мысленно), они все равно не могут быть ближе чем им позволяют их настоящие радиусы Thank you very much. You helped me a lot. 1)Pls, give me some tests 2)Am I right that answer < 10^18? Edited by author 22.07.2019 23:42 def bin_Search(arr, val): low = 0 high = len(arr)-1 while low <= high: mid = (low + high) // 2 if val < arr[mid]: high = mid - 1 elif val > arr[mid]: low = mid + 1 else: return True else: return False first = ["Alice", "Ariel", "Aurora", "Phil", "Peter", "Olaf", "Phoebus", "Ralph", "Robin"] first.sort() second = ["Bambi", "Belle", "Bolt", "Mulan", "Mowgli", "Mickey", "Silver", "Simba", "Stitch"] second.sort() third = ["Dumbo", "Genit", "Jiminy", "Kuzko", "Kida", "Kenai", "Tarzan", "Tiana", "Winnie"] third.sort() n = int(input()) pos = 1 steps = 0 for i in range(n): name = str(input()) if bin_Search(first, name) == True: steps += pos - 1 pos = 1 elif bin_Search(second, name) == True: if (pos - 2) < 0: steps += ((pos - 2) * -1) pos = 2 else: steps += pos - 2 pos = 2 else: if (pos - 3) < 0: steps += ((pos - 3) * -1) pos = 3 else: steps += pos - 3 pos = 3 print(steps)
In this solution i used binary search m, n = map(int, input().split()) if (m*n) % 2 == 0: print("[:=[first]") else: print("[second]=:]") import sys from math import sqrt potok = sys.stdin.read() spisok = potok.split()[::-1] if sys.getsizeof(potok)>262144: print('большой объем') quit() for i in spisok: i=int(i) if i>10**18 or i<0: print('неверный диапозон') quit() res = sqrt(int(i)) print("%.4f" % res) del Edited by author 21.07.2019 11:08 |
|