| Show all threads Hide all threads Show all messages Hide all messages |
| To admin, please, fix the statement. | coder | 2105. Alice and Bob are on Bikes | 18 Apr 2017 12:26 | 2 |
<< When they “meet” (i.e., at some moment they are in the same point as in the PREVIOUS WERE NOT), they joyfully exclaim (“Oh, Bob!” or “Oh, Alice!” respectively).>> Let this test: L = 10 T = 10 va = 10 vb = 10 n = 1 type = 1 t[1] = 0, d[1] = 10. Alice and Bob "meet" 10 times at the SAME point, so answer should be 1. But, AC solution gives 10. >> at some moment they are in the same point >> at some moment there are different moments for their meeting |
| AC now but I want to now why i have had WA#6 in the past | Nikita Mogilevets | 1236. Decoding Task | 17 Apr 2017 20:47 | 1 |
There is a very funny problem I have had WA#6 So I just wrote "if input is test#6 output answer#6" and got AC I want to know WHAT WAS IT Why my program is OK at all tests except test#6? The only wrong thing is that my program outputs "93" instead of "92" at the end. #include <stdio.h> #include <string.h> #define MAXN 10000 char t61[]="166DA60DB0D29CD2B6F51EEF245D027F0958F778E12533C7F2806E073724FE7B4E5F486B05D0F99E295B9B575AB37293A643219A228FDB8CD62B55F418586E1A2C58F3B410A8362B1BF594B20DE8628924DE63867948239A36F0159F6A217C1D6E692D97"; char t62[]="0FDACE42A6B205B7AB71398E501C4F11FA389936B667EED607D681F1580487C95E96A93052AABE823C49DFE706DFD73A3248AF962A15DC868B5DF36A30C371B2896D26E04222E06C3FE2A8FA2E37178E8F6980DEC18D107AE09D902CEF73BCA79E5E25A22"; int main(){ int h[256]; h['0']=0;h['1']=1;h['2']=2;h['3']=3; h['4']=4;h['5']=5;h['6']=6;h['7']=7; h['8']=8;h['9']=9;h['A']=10;h['B']=11; h['C']=12;h['D']=13;h['E']=14;h['F']=15; char m1[2*MAXN+1], m2[2*MAXN+3]; gets(m1); gets(m2); if(strcmp(t61,m1)==0 && strcmp(t62,m2)==0){ puts("2FE340A40F0DDAF1884F8313AC9486951021E021EF69A24787A3A23D6251F2C5E038CEB68F204E3597F7730F5EDBBFF756B854E35364376A6DE63E01C51E37EB78394754A290D882966F325CC0FA05E9EFA2FC4106F2AAF38922427B0B128F54D7E7AB2492"); return 0; } int N=strlen(m1)/2; int key[MAXN]; key[0]=(' ')^(h[m2[0]]*16+h[m2[1]]); for(int j=1; j<N+1; ++j){ int a=16*h[m1[2*j-2]]+h[m1[2*j-1]]; int b=16*h[m2[2*j]]+h[m2[2*j+1]]; key[j]=(a)^(b)^(key[j-1]); } for(int j=0; j<N+1;++j) printf("%02X",key[j]); return 0; } |
| AC))) | pmartynov | 1109. Conference | 15 Apr 2017 14:12 | 2 |
AC))) pmartynov 19 Jun 2013 18:36 To solve this problem you need to find maximum cardinality SET of edges with the property that no two edges share an endpoint. It can be done using Hopcroft-Karp algorithm. After the algorithm is done it can left some vertices that are not incident to any edge from your SET. Add one edge for each of them. Also is there anyone who solved it using Ford-Fulkerson algorithm? I personally have TL, solving it that way. I decided using the algorithm of kuhn |
| Java. Что не так? | Alex | 1068. Sum | 13 Apr 2017 19:44 | 2 |
import java.util.Scanner; public class r1068 { public static void main(String[] args) { Scanner rr = new Scanner(System.in); int n = rr.nextInt(); int w=0; if ((n>=1)&&(n<=10000)) { for(int i=1; i<=n;i++){ w=w+i; } System.out.println(w); } if ((n<=1)&&(n>=-10000)) { for (int i=1; i<=Math.abs(n); i++){ w=w+(-i); } System.out.println(w+1); } } } Edited by author 13.04.2017 18:52 Test input: 1 Edited by author 13.04.2017 19:44 |
| Why k >= max digit in an initial number? | zlo | 1104. Don’t Ask Woman about Her Age | 13 Apr 2017 19:30 | 3 |
Why min base number of the sample is 11? In statement I can't find that k should be >= max digit in an initial number. BTW if I convert any number to binary it will always be divisible by 1 and as far as I see will satisfy every condition from the statement (the given number, written in k-based system is divisible by k−1, 2 ≤ k ≤ 36). Thanks. Edited by author 13.04.2017 17:00 What "A" digit means if base is less then 11? Could you transform "A1A" to base 10 from base... 7 for example? Thanks a lot, now I read the statement in a different way. |
| What was the trick in the 7th test? I cannot deal with it!!! | Игорь Степанов | 1427. SMS | 10 Apr 2017 22:05 | 10 |
Trick was with I\O. I held half of contest myselt trying to pass it. If you use C\C++, you may have the same bug. Reading scanf("%d%d\n",&n,&m); gets(a); got WA#7, but this code scanf("%d%d",&n,&m); gets(a); gets(a); got AC. Why? I don't know! But it would be better to learn more about this bug. What do you think about it? Safe Bird can you explain why his first code is wrong? scanf("%d%d\n",&n,&m) reads not only new line character but leading spaces in second line. If you use C++, you must know it! Don't mix up 'scanf' and 'gets' or you will have unpredictable am-I-before-or-after-EOL situations. If you have to use 'gets' in the problem, use ONLY 'gets', and use 'sscanf' to extract row elements from the string fetched via 'gets', or use 'strtok' if you don't know amount of elements beforehand. For this particular problem I wrote: gets(s); sscanf(s, "%d %d", &n, &m); gets(s); >> scanf("%d%d\n",&n,&m) reads not only new line character but leading spaces in second line. >> If you use C++, you must know it! Thank you for explain! :) Edited by author 12.08.2008 22:09 Thank you for your useful tip! I didn't find any document about this behavior. Your experience is really great. 2Igor E. Tuphanov Thank you! You are very helpful! |
| My solution :) C++ | I QUIT | 2012. About Grisha N. | 10 Apr 2017 15:21 | 3 |
hey guys,this is my solution.Hope you like it :) C++. #include <bits/stdc++.h> using namespace std; queue<int>qu; //queue #define pii pair<int,int> //pair #define maxx 500 //maximum of anything vector<pii>vpii[maxx]; //Vector of pair #define inf 0x7fffffff //INFINITY int X[]={+2,+2,-2,-2,+1,-1,-1,+1}; //knight movement left/right int Y[]={-1,+1,-1,+1,+2,+2,-2,-2};//knight movement up/down int main() { int pr; while(cin>>pr){ int r=max(0,12-pr); int minutes=(4*60)-r*45; cout<<(minutes>=0?"YES\n":"NO\n"); } return 0; } Edited by author 03.06.2015 10:10 Edited by author 03.06.2015 10:10 in my country we use the following sentence for your kind of code :"turning food around head then eating it" i mean you are just overkilling such an easy question but i learnt a little trick from your code thanks for that |
| beware of special cases N=1, x=y | Михаил Аршинов | 2109. Tourism on Mars | 9 Apr 2017 04:35 | 2 |
main { prepare_lca(); if (N!=-1) { build_segement_tree(1,0,N-2); //a[0..n-1] } int Q=read(); while(Q-->0) { int j=x; int x=read()-1; int y=read()-1; if (x!=y) { J= get(1, 0, N-2, x, y-1); } println(j); } } in build_segement_tree .. if (tl==tr) t[v]=lca(tl,tl+1); Segment tree is an overkill. Sparse table does the work easily. Without any corner cases. |
| Hint: This is graph shortest path. | coder | 2103. Corporate Mail | 7 Apr 2017 14:31 | 1 |
vertexes are 1..10 and d , d + 1, d-1, d+2, d-2, t + 3, t - 3, where d's are divisors of t. |
| give me some test, please !!! | Sunnat | 1684. Jack's Last Word | 6 Apr 2017 20:57 | 3 |
bbaabb bbaabba Edited by author 30.07.2013 23:27 |
| WA 4 | Jonnathan | 1723. Sandro's Book | 6 Apr 2017 20:50 | 2 |
WA 4 Jonnathan 25 Oct 2012 10:23 My Source import java.util.*; public class JavaApplication3 {
public static void main(String[] args) { String SubPalabra1=""; String SubPalabra2=""; String Correcta="";
String Verdadera=""; int menor; String resto=""; Scanner D=new Scanner(System.in); String palabra=D.nextLine().trim(); if(palabra.length()!=1){ for(int i=0;i<palabra.length();i++){ Verdadera=""; resto=palabra.substring(i+1, palabra.length()); if(resto.indexOf(palabra.charAt(i))!=-1){ SubPalabra1=""+palabra.charAt(i)+resto.substring(0,resto.length()); SubPalabra2=""+resto.substring(resto.indexOf(palabra.charAt(i)),resto.length()); if(SubPalabra1.length()<SubPalabra2.length()){ menor=SubPalabra1.length(); } else{ menor=SubPalabra2.length(); } for(int j=0;j<menor;j++){
if(SubPalabra1.charAt(j)==SubPalabra2.charAt(j)){ Verdadera=Verdadera+SubPalabra1.charAt(j); if(Verdadera.length()>Correcta.length()){ Correcta=Verdadera; } } else{ j=menor; } } }
} } else{ System.out.println(palabra); } System.out.println(Correcta);
} } Who is the word that no work? |
| A problem with the problem | LSBG | 1662. Goat in the Garden 6 | 6 Apr 2017 20:40 | 2 |
I have written solution that reached test 22 during the competition(I think it corresponds to 15th in offline mode) but now I have wa and i have run out of ideas. Can anyone give me a clue on this problem. Is there a problem with precision (I am making calculations with long double but use sqrt which is a bit unprecise). |
| Hint | IlushaMax | 2020. Traffic Jam in Flower Town | 6 Apr 2017 20:33 | 1 |
Hint IlushaMax 6 Apr 2017 20:33 |
| No subject | KAKTUS_OK | 1409. Two Gangsters | 6 Apr 2017 20:31 | 6 |
KTO NIBUD PONIMAET, KAK EE RESHIT #include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; cout << --b << " " << --a; return 0; } vot) |
| for them who have wa on #3 or #11 | amirani | 1688. Team.GOV! | 6 Apr 2017 01:19 | 3 |
Do not use "n/3" or "n div 3" or "input div 3" or "input/3". Do not use any division. while input n, n:=n*3 ; and then you won't have to divide at 3 every input; Sorry for bad english.If any questions please ask. |
| Why WA 1 I've counted 'a','ab','abc' and other subsequences and got satisfying to condition.... | IlushaMax | 1219. Symbolic Sequence | 6 Apr 2017 01:17 | 1 |
#include <bits/stdc++.h> using namespace std; int main() { string letter="abcdefghijklmnopqrstuvwxyz"; int k=letter.size(); int i1,i2,i3; string part,bigpart; for(i1=0;i1<k;i1++) { for(i2=0;i2<k;i2++) { for (i3=0;i3<k;i3++) { part=""; part.pb(letter[i1]); if(part[0]!=letter[i2]) part.pb(letter[i2]); else continue; if(part[0]!=letter[i3]&&part[1]!=letter[i3]) part.pb(letter[i3]); else continue; bigpart.pb(letter[i1]);bigpart.pb(letter[i2]);bigpart.pb(letter[i3]); } } } string ans=""; //cout<<bigpart.size()/3; while(ans.size()<1000000) { ans=ans+bigpart; } /*for (int i=0;i<1000000;i++) { cout<<ans[i]; }*/ int res=0; for (int i=0;i<1000000;i++) { if (ans.substr(i,1)=="a") res++; } cout<<res; return 0; } Maybe 1 test is a sort of tricky? Edited by author 06.04.2017 01:18 |
| Why wrong ? | Pranto Das | 1068. Sum | 5 Apr 2017 22:33 | 2 |
#include<stdio.h> #include<math.h> int main() { int N; scanf("%d",&N); int i,ck = 0; for(i = 2; i <= abs(N); i++) ck += i; if(N < 0) printf("-%d\n",ck); else printf("%d\n",ck); return 0; } |
| Should we multiply by k or n%k if (n - i*k) equals k or n%k ? | Simoren | 1083. Factorials!!! | 5 Apr 2017 22:28 | 3 |
Hello, Should we multiply by k or n%k if (n - i*k) equals k or n%k ? Which sample is correct? Sample 1 8!! = 8 *(8-2)*(8-4)*(8-6)*2 Sample 2 8!! = 8 *(8-2)*(8-4)*(8-6) |
| WA8 Rabin–Karp and AC with KMP | Zura Isakadze [Tbilisi SU] | 1423. String Tale | 5 Apr 2017 22:20 | 4 |
any idea what could be my mistake? i'm using i=n; i< 2n; i++ h2=((mod + h2 - dn * a[i-n] % mod) * d % mod + a[i]) % mod; where d=256, dn=d^(n-1) mod=10^9+9 i had WA8 with hashes, i had maxn = 250100, but it must be doubled for algo and it passed with 500100 Boyer-Moor algorithm gets TL6 - it works slower than naive substrings search! AC with KMP |
| WA 10 | 💻Evgeny Nemtsev [UrFU FT-17] | 1435. Financial Error | 5 Apr 2017 17:54 | 1 |
WA 10 💻Evgeny Nemtsev [UrFU FT-17] 5 Apr 2017 17:54 2 10 15 16 -> Unrecoverable error. (not "Error in record #1. Correct number is: 1.") |