Common Boardand also N=6,K=10 N=7,K=10 N=6,K=2 N=5,K=10 the answer is 87480 N=6,K=10 the answer is 866781 N=7,K=10 the answer is 8588349 N=6,K=2 the answer is 13 my program has been accepted I have solved this problem,but I got WA on test #2.When n=6,k=10 I get answer 866781 and others tests I get right answer.What is the test #2??????????????? N=5,K=10 the answer is 87480 350975 350974 350973 350971 350970 350967 350966 350965 350959 350958 350957 350955 350954 350943 350942 350941 350939 350938 for n = 6 , k = 2 this values are true more than 13 You are not right because k = 2 => all numerals < 2. Ok? And now I show you this 13 numbers: 111111 111110 111101 111011 110111 101111 111010 110110 110101 101110 101101 101011 101010 sorry for my English Edited by author 19.08.2020 13:21 Edited by author 19.08.2020 13:21 For some reason, my code gets the right answer for all small inputs (<12) but is 1 greater than both the large test cases I've found. It gets that s(212) = 995645336, as compared to 995645335, and s(500) = 732986521245024, as compared to 732986521245023 given before. Anyone have any test cases with an input between 11 and 212 to help me pinpoint this problem? Edited by author 18.08.2020 20:03 I don't know any string of length 7 contains less than 7 distinct palindrome substrings. Anyone can put the answer for 7, pls? It may be too later. for n = 7 1 : NO 2 : NO 3 : NO 4 : NO 5 : NO 6 : NO 7 : aaaaaaa for n = 15 1 : NO 2 : NO 3 : NO 4 : NO 5 : NO 6 : NO 7 : NO 8 : aababbaababbaab 9 : aaababbaaababba 10 : aaaababbaaaabab 11 : aaaaababbaaaaab 12 : aaaaaaababbaaaa 13 : aaaaaaaababbaaa 14 : aaaaaaaaababbaa 15 : aaaaaaaaaababba 1) in: 3 5 ..*.. !.... ....$ out: 3 2) in: 5 8 ....AA.# .######! ...BA*## .####### ..B$...B out: 3 3) in: 5 8 ....AA.# .######! ....#*## .####### ..B$...B out: Impossible 4) in: 1 3 $*! out: Impossible 5) in: 1 3 *!$ out: 2 I have used BFS, but still WA 22 :-( Edited by author 26.10.2008 13:57 Edited by author 26.10.2008 14:04 Edited by author 26.10.2008 14:17 Now Accepted :-) All my tests are correct!!! Edited by author 26.10.2008 16:17 the army can stay in one point ? so in this input 1 3 *!$ the corresponding output is 2 ? Can you lell what was wrong with your program? I`m having WA 22... Please give me some test i also used BFS, but have WA10. Your tests are passed on my computer. Could you give more tests? 5 7 ..!.... ....... .####.* ....... ..$.... Answer: 4 This test help me with wa21 This one helped me to deal with WA10. 1 3 !*$ Answer: Impossible Interesting problem. But only after few WA I understood problem statement correctly :) There is something wrong with limitations is the statement. I set maxN = 300 and got AC. This test helped me to pass WA11: 3 5 .AAA! .A*A. $AAA. output: 2 Another interesting test: 1 12 #AB$#A!B#B*# output: 2 Edited by author 05.08.2012 02:31 Thanks! Thanks to your first test, I found out that I misunderstood the condition. Try this test: 3 3 ##$ #*# !## Answer: Impossible thank you! I am trying deal with this problem #include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int Num = 0, ans = -2; cin >> Num; vector <int> fact; int n = 2; while (Num > 1) { if (n > 9) { ans = -1; break; } while (Num % n == 0) { Num /= n; fact.push_back(n); } n++; } sort(fact.begin(), fact.end()); if (n < 10 & ans != -1) { ans = 0; for (int i = 0; i < fact.size(); i++) { //ans += fact.at(i) * (i*10); cout << fact[i]; } } //cout << ans; } Hey! I solved this problem and here are some test that you may check for you solution: 0->10 1->1 2->2 3->3 4->4 5->5 6->6 7->7 8->8 9->9 10->25 11->-1 12->26 13->-1 14->27 15->35 16->28 17->-1 18->29 19->-1 20->45 21->37 22->-1 23->-1 24->38 25->55 26->-1 27->39 28->47 29->-1 30->56 31->-1 32->48 33->-1 34->-1 35->57 36->49 37->-1 38->-1 39->-1 40->58 41->-1 42->67 43->-1 44->-1 45->59 46->-1 47->-1 48->68 49->77 50->255 51->-1 52->-1 53->-1 54->69 55->-1 56->78 57->-1 58->-1 59->-1 60->256 61->-1 62->-1 63->79 64->88 65->-1 66->-1 67->-1 68->-1 69->-1 70->257 71->-1 72->89 73->-1 74->-1 75->355 76->-1 77->-1 78->-1 79->-1 80->258 81->99 82->-1 83->-1 84->267 85->-1 86->-1 87->-1 88->-1 89->-1 90->259 91->-1 92->-1 93->-1 94->-1 95->-1 96->268 97->-1 98->277 99->-1 100->455 Good Luck! I have checked for my solution. All done. But I have "Wrong answer" at test 8..... try this test: 732421875 result must be: 3555555555555 and this: 0 (result: 10) 1 (result: 1) Edited by author 15.06.2011 14:32 Shouldn't the test value for 1 be 11 and so on for single digit numbers? Edited by author 17.08.2020 15:23 Edited by author 17.08.2020 15:23 Edited by author 17.08.2020 15:23 Max distance may be equal 5e4 * 1e3 = 5e7. I use INF = 1e6 and spent all day to find this bug. //We need to sort out 3 in the second power of the options for the arrangement of signs #include <iostream> using namespace std; int main() { int a, b, c, min; cin >> a >> b >> c; min = a + b + c; if(a + b - c < min) min = a + b - c; if(a - b + c < min) min = a - b + c; if(a - b - c < min) min = a - b - c; if(a - b + c < min) min = a - b + c; if(a - b * c < min) min = a - b * c; if(a * b * c < min) min = a * b * c; if(a * b + c < min) min = a * b + c; if(a * b - c < min) min = a * b - c; cout << min; return 0; } Is it right that p is divisor of n? If not, Can you write example? for each step d len of period equals to gcd(d, n) Edited by author 14.08.2020 21:59 I think, this should be renamed to "Cipher Message 4" Edited by author 13.08.2020 12:24 Edited by author 13.08.2020 12:24 UPD: i have find mistake Edited by author 13.08.2020 00:16 PLEASE!!!! 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 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()) 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 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 #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. |
|