| Show all threads Hide all threads Show all messages Hide all messages |
| How do you think, why it`s not work? UPD: CLOSED!!! | AleshinAndrei | 1207. Median on the Plane | 12 Aug 2020 22:59 | 1 |
UPD: i have find mistake Edited by author 13.08.2020 00:16 |
| I have WA6. Please anybody HelpME! | 107th | 1655. Somali Pirates | 10 Aug 2020 14:40 | 4 |
Maybe it's because of accuracy? (in case you are still alive) was it because of accuracy ? I was using doubles and got WA8 due to precision error, but then I changed all of the doubles to pair<long long, long long> (trying to represent them as rational fractions without any loss of accuracy) and got AC. Edited by author 10.08.2020 14:42 Edited by author 10.08.2020 15:53 |
| For python users having RE1 | elsa.mathlover | 1011. Conductors | 10 Aug 2020 13:48 | 1 |
Input in the task looks like: 13 14.1 Not like: 13 14.1 So change input in your program to p,q=map(float, input().split()) |
| O(p^2) works | buyolitsez`~ | 1375. Bill Clevers | 10 Aug 2020 11:52 | 1 |
0.046 - O(p) solution. 0.468 - O(p^2) solution, please add more tests. UPD: understood, that there is cant be NO SOLUTION. But you can enlarge p. Edited by author 10.08.2020 12:39 |
| what is in test №37? | Rodion | 1880. Psych Up's Eigenvalues | 8 Aug 2020 18:57 | 1 |
this is my code a=int(input()) b = [int(a) for a in input().split()] c=int(input()) d = [int(c) for c in input().split()] e=int(input()) f=[int(e) for e in input().split()] spisok=b+d+f spisok.sort() kolich=0 for i in range(0, len(spisok)-1): if spisok[i-1]==spisok[i] and spisok[i]==spisok[i+1]: kolich+=1 print(kolich) i dont know why but it writes wrong answer on test №37 please could you text me what is on this test |
| Wa10 | Михаил | 1427. SMS | 7 Aug 2020 19:03 | 1 |
Wa10 Михаил 7 Aug 2020 19:03 |
| Memory limit exceeded for test case 7 | Foysal Ahammed | 1306. Sequence Median | 7 Aug 2020 18:43 | 3 |
#include <bits/stdc++.h> #include<cstdio> #include <queue> #define pb push_back #define mp make_pair //Macro #define eps 1e-9 #define pi acos(-1.0) #define ff first #define ss second #define re return #define QI queue #define SI stack #define SZ(x) ((int) (x).size()) #define all(x) (x).begin(), (x).end() #define sq(a) ((a)*(a)) #define distance(a,b) (sq(a.x-b.x) + sq(a.y-b.y)) #define iseq(a,b) (fabs(a-b)<eps) #define eq(a,b) iseq(a,b) #define ms(a,b) memset((a),(b),sizeof(a)) #define G() getchar() #define MAX3(a,b,c) max(a,max(b,c)) #define II ( { int a ; read(a) ; a; } ) #define LL ( { Long a ; read(a) ; a; } ) #define DD ({double a; scanf("%lf", &a); a;}) double const EPS=3e-8; using namespace std; #define FI freopen ("input_B.txt", "r", stdin) #define FO freopen ("output_B.txt", "w", stdout) typedef long long Long; typedef long long int64; //For loop #define forab(i, a, b) for (__typeof (b) i = (a) ; i <= b ; ++i) #define rep(i, n) forab (i, 0, (n) - 1) #define For(i, n) forab (i, 1, n) #define rofba(i, a, b) for (__typeof (b)i = (b) ; i >= a ; --i) #define per(i, n) rofba (i, 0, (n) - 1) #define rof(i, n) rofba (i, 1, n) #define forstl(i, s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i) #define for1(i, a, b) for(int i=a; i<b; i++) template< class T > T gcd(T a, T b) { return (b != 0 ? gcd(b, a%b) : a); } template< class T > T lcm(T a, T b) { return (a / gcd(a, b) * b); } #define __(args...) {dbg,args; cerr<<endl;} #define __1D(a,n) rep(i,n) { if(i) printf(" ") ; cout << a[i] ; } #define __2D(a,r,c,f) forab(i,f,r-!f){forab(j,f,c-!f){if(j!=f)printf(" ");cout<<a[i][j];}cout<<endl;} signed main () { ios_base :: sync_with_stdio(0);cin.tie(0);cin.tie(0); int n; unsigned int a; priority_queue <unsigned int> pq; scanf("%d", &n); bool odd = (n%2==1); for(int i=n/2; i>=0; --i){ scanf("%u", &a); pq.push(a); } n-=n/2+1; for(int i=0; i<n; i++){ scanf("%u", &a); pq.push(a); pq.pop(); } if(odd)printf("%u\n", pq.top()); else{ a=pq.top(); pq.pop(); // cout << fixed << setprecision(1) << (a+pq.top())/2.0 << endl; printf("%.1f\n", (a + pq.top() ) / 2.0); } return 0; } Priority queue uses vector under the hood. How many times vector resized while first for() executed - unknown, what final vector capacity - unknown, was all vector buffers except last freed or they still kept by allocator - unknown. I'd recommend to not use priority queue at all, I'd rather implement custom bike using fixed size buffer and std heap functions There must be no problem with vector - I used it successfully but care about its size in advance (reserve and shrink). Be careful in printing big numbers (float not enough) and in using iterators - this is the problem of memory error could be - you may point to out of vector. Also different compilers use compile program with different size and use different allocators - try to use different compilers. |
| Admin! How Come! TEST4 N-1? | deLarry | 1252. Sorting the Tombstones | 7 Aug 2020 18:41 | 2 |
It says, that K is an amount of stones BETWEEN other stones. Why does Test4 answer equal n-1. I suppose it should be n-2, shouldn't it? Edited by author 26.12.2016 16:46 You should read the problem statement more clearly. Since K<N, if the array is sorted then K=N-1. |
| If you got WA | Ilya Mitin | 1018. Binary Apple Tree | 7 Aug 2020 13:08 | 23 |
0) AC solve is DP on tree. 1) In DP inf = 1e9. 2) All test in the forum: 5 5 3 1 1 4 1 10 2 3 20 3 5 20 ans = 21 7 4 1 2 10 1 3 20 2 4 30 2 5 0 3 6 0 3 7 40 ans = 100 4 1 1 2 1 1 3 2 2 4 3 ans = 2 5 1 1 2 1 1 5 0 2 3 0 2 4 0 ans = 1 7 3 1 2 1 1 3 39 2 4 40 2 5 40 3 6 39 3 7 39 ans = 117 5 2 1 3 1 1 4 10 2 3 20 3 5 20 ans = 21 Edited by author 12.05.2008 19:54 thanks a lot for your test cases! Thank you for test data. I suppose there is typo in case #1. Correct answer must be 51. Why in the first example ans=21? I think it must be 51. Why in the first example ans=21? I think it must be 51. First test is incorrect. Q must be <=N-1. I could AC all your tests, but I still got WA. My falt was that my inf was too litlle ^^ thx a lot! 吃粪汁啦 第一组和第三组数据吃粪一样的。。。第一组很明显不可能啦 第三组这叫一个苹果“二叉”树 Edited by author 03.12.2011 06:51 Edited by author 03.12.2011 06:51 3-rd test case is incorrect, because "any biparous branch splits up to exactly two new branches" Remember that the tree should always be a tree (you can't split it into several components)... are you sure i think 5 5 mean we must have all vertex ans ans is 51 5 5 3 1 1 4 1 10 2 3 20 3 5 20 ans = 51 |
| hint | Rodion | 1924. Four Imps | 6 Aug 2020 20:30 | 1 |
hint Rodion 6 Aug 2020 20:30 no matter who plays first and which sign is between numbers |
| tests ;) | Mapu | 1931. Excellent Team | 5 Aug 2020 20:10 | 2 |
5 5 4 3 2 1 (2) 1 1 (1) 10 3 3 4 2 5 6 1 9 9 3 (4) wrong answer on 1st test obmanul suka |
| output format hint (wa1) | Olerinskiy | 1160. Network | 5 Aug 2020 18:01 | 1 |
you should output edges in input order |
| Why Run Time error? 1WA Python | CatGirl | 1877. Bicycle Codes | 5 Aug 2020 17:56 | 3 |
a,b = map(int,input().split()) if (a % 2 == 0 and b % 2 != 0): print("yes") else: print("no") because data type should be string, not integer sorry, my bad. data type is correct, but you should input like that: a=int(input()) b=int(input()) |
| WA8: hint | KostyaRychkov | 2034. Caravans | 3 Aug 2020 17:58 | 1 |
Check that you use only shortest routes. I don't have any tests, but when I started checking this, then I got ACC. |
| Wa3 | Михаил | 1121. Branches | 3 Aug 2020 14:43 | 1 |
Wa3 Михаил 3 Aug 2020 14:43 Таким образом, если для данного перекрёстка нет подразделений СКБ Контур находящихся ближе, чем в 6 кварталах, то мы обозначим его числом 0. Carefully read this part of text. |
| If you have RE5 | KostyaRychkov | 1860. Fiborial | 1 Aug 2020 01:05 | 1 |
Try n = 100000 and remember that 1e6 * 1e6 > 2e9. |
| This problem is simpler than the rating he has )) | KostyaRychkov | 1091. Tmutarakan Exams | 31 Jul 2020 21:31 | 1 |
The most important thing is that you shouldn't keep finding sets when you've already found 10,000. Then you can optimize a little simple search and you get ACC. Good luck! |
| INPUT | Berdnikov Sergey | 1242. Werewolf | 31 Jul 2020 21:16 | 2 |
INPUT Berdnikov Sergey 26 Jan 2017 04:10 To enter variables correctly is more difficult then solve this problem. I think, it isn't very good idea to issue input like this. |
| What is test 5? | mr.erfan | 1930. Ivan's Car | 31 Jul 2020 21:05 | 1 |
please help me. i have some problems in test 5. please help me! |
| Very Simple Only a DFS!! | Pooya | 1039. Anniversary Party | 31 Jul 2020 13:58 | 10 |
my DFS is TLE does DFS don't TLE? can someone give me some help? ppsxy you should write DP of course. what's more my program doesn't TLE.Instead it WAs on #12 ناموسا ایرانی هستی؟ ای کلک |