| | Common Boardint main(){
 int n;
 string s1, s2;
 cin >> n >> s1 >> s2;
 s1 += s1;
 int pos = (int) s1.find(s2);
 switch ( pos )
 {
 case -1:
 cout << -1;
 break;
 case 0:
 cout << 0;
 break;
 default:
 cout << n-pos;
 }
 return 0;
 }
 Unfortunately, your solution has been rejudged. :) string.find() is too slow. Good luck!¿Any idea of why a code can pass all the tests except the test 6 ? I prove my code with this imput, and it works fine
 7325189087
 5
 it
 your
 reality
 real
 our
 4294967296
 5
 it
 your
 reality
 real
 our
 213456
 12
 id
 a
 h
 lm
 aid
 aidhlm
 hl
 m
 dhlm
 ai
 aid
 hlm
 2017697240238123468420176972402381234684201769724023812346842017697240238123468420176972402381234684
 7
 azipmwpbgqadtjafhmth
 azipmwpbgqadtjafhmth
 azipmwpbgqadtjafhmth
 azipmwpbgqadtjafhmth
 azipmwpbgqadtja
 azipmwpbgqadtjafhmthazipmwpbgqadtjafhmthazipmwpbgqadtjafhmthazipmwpbgqadtjafhmth
 fhmth
 27386428376
 0
 97854668689678768
 3
 dfgdfhjghjdggzash
 dfgkjt
 nkhhdfsge
 11111111111
 5
 ij
 jj
 ji
 j
 i
 1234567890
 5
 bdh
 txo
 bdhkmp
 i
 kmp
 -1
 the answer is :
 reality our
 No solution.
 aidhlm
 azipmwpbgqadtjafhmth azipmwpbgqadtjafhmthazipmwpbgqadtjafhmthazipmwpbgqadtjafhmthazipmwpbgqadtjafhmth
 No solution.
 No solution.
 ji ji ji ji ji i
 i bdhkmp txo
This is my code:
 import time
 import sys
 sys.setrecursionlimit(100000)
 
 n = int(input("Enter N (for digits): "))
 k = int(input("Enter K: "))
 
 rangeVar = pow(k, n) - pow(k, n-1)
 starter = pow(k, n) - rangeVar
 counter = 0
 
 start = time.clock()
 def calc(i):
 global starter, rangeVar, counter, n, k
 
 temp = str(i)
 
 if i == pow(k, n):
 return counter
 else:
 for j in range(len(temp) - 1):
 if temp[j] == '0' and temp[j+1] == '0':
 counter += 1
 calc(i+1)
 
 calc(starter)
 end = time.clock()
 print(rangeVar - counter)
 print(end - start)
Remove repetitions before applying your algo i.e.: sequences like 2 1 2 2 2 2 1 change into 2 1 2 1It helped me with WA#21
 Yep. For understanding why, lets consider:1 7
 3 2 1 4 4 5
 They should  be 7 numbers in the list!This test is something like this2 2
 1 2
 1 2
 1 2
 Correct answer is YES
 Thank. This test help me to get ACThank you very much,but now I've WA#33.Thank you!!! Thanks for test, i got ACThanks a loooooooooooooooot!I am get WA on test 4. 33.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.
 ................................#
 #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
 ##.#.#.#.#.#.#.#.#.#.#.#.#.#.#...
 ...............................##
 #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
 #..#.#.#.#.#.#.#.#.#.#.#.#.#.#...
 ................................#
 #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
 ##.#.#.#.#.#.#.#.#.#.#.#.#.#.#...
 ...............................##
 #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
 #..#.#.#.#.#.#.#.#.#.#.#.#.#.#...
 ................................#
 #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
 ##.#.#.#.#.#.#.#.#.#.#.#.#.#.###.
 ................................#
 #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
 #..#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.
 ................................#
 #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
 ##.#.#.#.#.#.#.#.#.#.#.#.#.#.#...
 ...............................##
 #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
 #..#.#.#.#.#.#.#.#.#.#.#.#.#.#...
 ...............................##
 #.##.#.#.#.#.#.#.#.#.#.#.#.#.#...
 ................................#
 #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
 #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
 ##.#.#.#.#.#.#.#.#.#.#.#.#.#.#...
 ...............................##
 #.#.#.#.#.#.#.#.#.#.#.#.#.#.#....
 
 
 answer: 12384
 
 check other tests at timustests.lx.ro
 15:  #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#16:  ##.#.#.#.#.#.#.#.#.#.#.#.#.#.###.
 第15,16行之间不能连通!
I am get WA on test 4 too!test 4 is wrong!
 我知道TEST 4怎么WA的了!有几点要归纳出来:
 1:
 ural 有保留字:
 Following words are reserved. For Pascal: as
 class
 dispose
 except
 exit
 exports
 false
 finalization
 finally
 initialization
 is
 library
 new
 on
 property
 raise
 true
 try
 我就使用了"try"这个保留字,结果就编译错误了。
 2:
 第四个数据的底15,16行不能连通!
 所以:要从点(1,1)与点(N,N)分别搜索!(我是广搜)
 如果只从点(1,1)开始搜,结果为:5760。
 如果只从点(N,N)开始搜,结果为:6624。
 两者之和正好是正确答案:12384 !
 
 希望我写的这些对你有用!
 IMS:WITHOUT WAX
 CS,HN,CHINA
 2006,07,02    23:55
 
 
 
 Thank you very much!You are so clever!thanks a lot!!!!!!!!!!!!!!!! :)you are so clever ! Thanks very much !可以中文??? 上面的几位聪明的中国大牛同胞,看没看见下面的Rules?明确写着“Messages should be written in English.(消息必须用英文写)”,请遵守规则,谢谢。-------
 To my clever Chinese friends above, didb't you see the Rules below? It says clearly that "Messages should be written in English." Please obey that. Thanks.
 You also used Chinese. Hah, i guessed myself that labyrinth can have no way from entrance to exit )the thing is, there doesn't have to be a path from 1,1 to n,n, so you have to check both sides. i got WA at test 4 ,too!
 thank you!!
 
 why cant't discussion be written in chinese or russia??
 
 # Messages should NOT contain source code (especially correct solutions). why??  i think source code indeed may cause cheat,but someone who always gets WA really need them to improve
 
 Edited by author 28.03.2008 06:14
 
 Edited by author 28.03.2008 06:15
Good Point~ Thankx The reanson why Test#4 is valid is we can enter upper left as well as lower right.  the thing is, there doesn't have to be a path from 1,1 to n,n, so you have to check both sides.Edited by author 13.08.2009 08:22Simple test for those who had WA #4:3
 ..#
 .#.
 #..
 Answer is 108.
Thanks! I got WA in test 4 too.Need help. Stuck for serval weeks!What is wa3 like?
 What is wa6 like?
Store a sorted array [L...R]  in each vertex of your ST,  corresponding to [L;R]. Hey!Do you mind explaining the Segment tree approach a little bit more? I still couldn't understand
 HiIt is frequently called merge sort tree
So there is an array TRANSPORTED[i]If we have want to find some value in interval of array cells from i=l to i=r
 We can do binary search in sorted sequence TRANSPORTED[l], TRANSPORTED[l+1],... TRANSPORTED [r-1], TRANSPORTED[r]
In merge sort treeWe have some sorted subsequences precalculated
 It is possible to represent any subsequence [l..r] as union of O(log(n)) such precalculated subsequences
Скажите, пожалуйста, как можно на Вашем сайте создать свою "олимпиаду", турнир по программированию.Please Help and give me some tests! Never mind got it.The case is like this
 10
 <<<<><>>>>
 I just forgot to count the '>' that can never be used for swapping.
 
 Edited by author 01.11.2017 20:58
If in the line "outputon", this does not mean that you need to put "out" and "puton", since sometimes you can put "output" and "one".
 Сheck out this test:
 1
 outputone
 Answer : "YES"
 
 Perhaps this will help you.
 
 Edited by author 01.11.2017 18:28
 
 Edited by author 01.11.2017 18:29
 If start from all the leaf airport that from one airport could win, start from this airport suerly will lose. Otherwise,he could win.My program had such mistake: it has printed results in the order in which athletes have finished the race, but the task is to print results in order in which athletes have started one. Here is my code which has been written in java. Please help me. I cannot understand what wrong is. Or some tests you have ?. Thanks.
 
 public class EsreveRredrO_1226 {
 public static void main(String[] args) throws IOException {
 BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
 String s = reader.readLine();
 solve(s);
 }
 
 public static void solve(String s) {
 String text[];
 text = s.split(" ");
 for (int i = 0; i < text.length; i++) {
 String revers = "";
 String temp;
 for (int j = text[i].length() - 1; j >= 0;  j--) {
 revers = revers.concat(String.valueOf(text[i].charAt(j)));
 }
 if (revers.charAt(0) == '!' || revers.charAt(0) == ',' || revers.charAt(0) == '.' || revers.charAt(0) == '?'
 || revers.charAt(0) == ':' || revers.charAt(0) == ' ') {
 temp = revers.substring(1, revers.length());
 revers = temp.concat(String.valueOf(revers.charAt(0)));
 }
 if (i != text.length - 1)
 System.out.print(revers + " ");
 else System.out.print(revers);
 }
 }
 }
 
 Edited by author 04.09.2017 00:45
 I remember the problem is quite a pain in the assI remember in that problem you should pay attention on all symbols
 
 If there is new line \n\r you print so
 If just \n you print \n
 
 If there is no EOF you don't print EOF
 
 I have not read your code
 
 I have WA2 for a long time
 
 And those symbols at the end of the line were related to those WA's
 Thanks for your words. I did care each symbol and didn't print any additional character at the end, and got AC. :)61 3 2 6 5 4
 
 answer: 0
 
 Edited by author 31.10.2017 02:47
it's one of the most awful descriptions of the problems i've ever seen. some corner cases, which are really questionable, are not explained. it really irritates because instead of solving the next problem you need to guess what the answer is. how should i know what is the answer for 1? i am not linguist, but smth tells me, that there are no situation when you can find elements in between in the list of one element. what is the answer? should i put 0, 1, etc? after all it's not a competition, i can't even ask the judge or stuff how should i interpret the problem itself.
 Edited by author 31.10.2017 02:27
I wrote simple implementation but can't figure out test to prove my solution wrong.
 4 3 -> 4
 3 3 -> 2
 4 5 -> 6
 4 6 -> 7
 3 8 -> 8
 6 5 -> 8
 6 8 -> 10
 
 #include "stdio.h"
 #include <stdlib.h>
 
 int main(void) {
 int bigger, lesser, a, b;
 scanf("%d", &a);
 scanf("%d", &b);
 if (a >= b) {
 bigger = a - 1; lesser = b - 1;
 } else {
 bigger = b - 1; lesser = a - 1;
 }
 
 if (bigger % lesser == 0) {
 printf("%d\n", bigger); return 0;
 }
 
 printf("%d\n", bigger + lesser - 1);
 
 return 0;
 }
 
 Found it7 11  -> 14
 13 21 -> 16
 GCD is the key ;-)
4 100aaaaaaaaaaaaaaaaaaaa11aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa111
 ans : 4
 I still get this one right and get WA on test 8. Is this test real? 
 Edited by author 15.10.2006 11:24
 Check each region by x and y, e.g.if (b+c<=y && y<=b+c+b && c <= x && x<=c+a) // bottom region
 I had some mistakes likeIf y>=a+b+c ...
 but must be
 If y>=b+b+c
 
 I have one check per one side.
 For example
 If y<=b - the point is on the lowest side (on the picture).
 If x<=c - the point is on the leftest side.
 etc.
 
 So, it is enough to check, you see, but WA#7.
 
 Thanks for help but still need it. )
 You need checky > b+b+c and y < b+c..
 
 because when point on the edge .... You can do mistake ...
 (I was wrong in this)
 I have AC, so thank U very much!But I still don't understand my mistake.
 It is guaranted that the point is in the picture, so
 I can only check one coordinate...
 
 Cann't understand...
 be careful when you do checks likeif (x <= a) then ...
 it can produce WA, becouse if x = a, point can lie on another side
 Yes, that is true.Thank you.
 The test that makes the difference is:
 -------
 2 2 2
 0 4
 4 0
 -------
 before this correction the answer was 4.8989794856 (wrong!)
 but the right answer is 2.8284271247 (verifyed with AC program).
 This is great test. Thank you!TY, Paul Diac!
 Edited by author 30.10.2017 01:21
If you use real numbers, you can get situation, when point lies on none of 6 sides. So you should work with epsilon. Or you can use exact arithmetic, just multiply numbers by 100!
 
 
 It means 100 and !, not 100! :)
 
 Edited by author 26.06.2009 17:41
 | 
 |