Common BoardPlease help me with WA#10. Can you give me the test in which my program outputs this WA.   program Project1; {$LONGSTRINGS ON} {$APPTYPE CONSOLE}   uses   SysUtils;   var c,lc:char;     ans:longint;     b:boolean;   begin   {$IFNDEF ONLINE_JUDGE}   reset(input,'input.txt');   rewrite(output,'output.txt');   {$ENDIF}   ans := 0;   b := false;   c := #1;   while not eof(input) do   begin     lc := c;     read(c);     if (c in ['a'..'z']) and (not b) then       inc(ans);     if (c in ['A'..'Z']) and (lc in (['A'..'Z'] + ['a'..'z'])) then       inc(ans);     if not (c in ['.','?','!',' ',#10,#13]) then       b := true;     if c in ['.','?','!'] then       b := false;   end;   write(ans); end. -a.   Answer is 1, but your program gives 0. My program give rigth answer for test :   input: -a.   output: 1   WHY I HAVE WA10????????!!!!!!!!!!!!!!! if you failed on test 10,try the follwing data or see the item Posted by Alam Md Mahabub September 27, 2001 14:23 ****************************************** Re: Can you give any judge data for which this code gives WA. Posted by SHMAK November 05, 2007 05:17 /*************************************** strange... but there are 5 mistakes:   The old va[R]sag my Antonesgh..%[s]g4mahng 35tsavx 3mnkxb o o oo A[A] gfsd . [s]dgw a a[A] Aa ********************************* the weild part is that the last sentence doesnot contain  a full stop, a question-mark or an exclamation mark
    for me WA10 got away after i added check for digits in my condition to start new word. e.g. "A0B" have 0 errors Hello! If you have WA 31 (I haven't seen these yet, but all is possible:D), try these test: 5 2 0 3 0 1 0 3 5 0 4 0 -- 4 5 0 Maybe it will help you.   Edited by author 28.07.2016 14:58 For example: 1 9 My AC solution outputs 0.   Apparently, the problem statement is incomplete. It should guarantee that for the given tests a solution always exists. It is told that F is a multiplicative function. So F(1)=1 by definition. What it is test 20 ?   Edited by author 27.07.2016 17:35   Edited by author 27.07.2016 17:35   Edited by author 27.07.2016 18:36 Please, give me some tests. I can't understand why i get WA4. Please make sure your solution meet the requirement "If two people share an apartment, each pays half of the rent." This is that I missed in my first solution. I did this, but it's still WA4. Why wa26?) Tests help me to pass test 2 and test 3. 9 1 -1 2 1 1 0 2 2 0 1 -2 2 -1 0 -2 1 -1 -1   1.00   12 2 1 1 1 1 2 -1 2 -1 1 -2 1 -2 -1 -1 -1 -1 -2 1 -2 1 -1 2 -1   1.41 AC 6 0 0 0 -3 1 -2 2 -2 3 -3 3 0   1.00 Test help me ThankU for the tests, they were useful to me, but I still having WA on test 15, any help will be apreciated. never mind...   Edited by author 28.07.2016 07:32 class Node:     def __init__(self, name, number):         self.name = name         self.number = number         self.children = []       def d(self, name):         for i in self.children:             if i.name == name:                 self.children.remove(i)         for i in self.children:             i.d(name)  
  def fnc(cmds, item, isenb, root):     for c in cmds:         if item.name in c:             for n in c:                 if not n in isenb:                     isenb[n] = item.number + 1                     item.children.append(Node(n, item.number + 1))                 elif isenb[n] > (item.number + 1):                     isenb[n] = item.number + 1                     root.d(n)                     item.children.append(Node(n, item.number + 1))     for i in item.children:         fnc(cmds, i, isenb, root)
  import sys if __name__=='__main__':     n_command = input()     if(int(n_command) > 0):         isenb = {}         cmds = []         for i in range(0,int(n_command)):             cmds.append(input().split())         flag = False         for c in cmds:             if "Isenbaev" in c:                 flag = True                 break         if flag:             root = Node("Isenbaev", 0)             isenb["Isenbaev"] = 0             fnc(cmds, root, isenb, root)         for c in cmds:             for i in c:                 if not i in isenb:                     isenb[i] = "underfined"         s = ''         for key,value in sorted(isenb.items()):             if s == '':                 s += (str(key) + ' ' + str(value))             else:                 s += ('\n' + str(key) + ' ' + str(value))         sys.stdout.write(s)     else:         sys.stdout.flush()     i solved, but my algo so slow, how can i solve this problem faster, sorry for my english. thx! Lets consider the sequence for n=4: 0000 0001 0010 0100 0101 1000 1001 1010   Try to find a connection between the number of all sequences with length 4, those which begin with 0 and those which begin with 1. After that look "deeper" and "deeper" into each sequence and try to find a way to generate the k-th sequence. Sorry that I'm not telling you the algorithm directly, but the feeling when you discover it yourself is great :) (it's even greater when you get Acc from 1-st submition :P). I hope that you find this helpful. thanks a lot, i think i can find it!! wow i feel good ¬¬_.'[smoke] ty for the idea Tnk u. Ur hint is very helpful. I got AC! Lets consider the sequence for n=4: 0000 0001 0010 0100 0101 1000 1001 1010   Try to find a connection between the number of all sequences with length 4, those which begin with 0 and those which begin with 1. After that look "deeper" and "deeper" into each sequence and try to find a way to generate the k-th sequence. Sorry that I'm not telling you the algorithm directly, but the feeling when you discover it yourself is great :) (it's even greater when you get Acc from 1-st submition :P). I hope that you find this helpful.        Thank u so much.... :) It really feels wow... :D Please give me test 6? Please give me test 6?   Try these Tests:  Test 1: 43 999999999 Ans=>1010000100100001010101000001000101000100101  Test 2: 42 999999999 Ans=> -1  Test 3: 40 100000000 Ans=>0010101001010100001010000010101010000010      Can anyone please suggest the test case which might give me WA35...   I have used string , also tried with character array...  and KMP algorithm   ..... please do reply My solution was rejudged and I got WA 35 :) They added tests against hashes modulo 2^64. don't print endline symbol after last query:   for(int i=0;i<queries;i++){ answer_the_query(); if(i!=queries-1) printf("\n") //without this line it got wa#1! }   Edited by author 15.09.2010 08:42 Your solution works.Thanks a lot!!! I've made a browser extension that adds charts of count of solved problems to Timus profiles.  You can find screenshots, installation instructions, and source code here: http://github.com/borzunov/timus-charts/blob/master/README.md The extension is available for Chrome, Firefox (with Greasemonkey) and Opera.  Edited by author 20.07.2016 22:47#include<iostream> #include<list> using namespace std; bool in_the_range(char a) {     if (a >= 'a'&&a <= 'z')     {         return true;     }     else     {         return false;     } }   int chance_one_symb(char in_symbol, char out_sybmbol) {     if ((in_the_range(in_symbol) && in_the_range(out_sybmbol)) || !(in_the_range(in_symbol)) && !(in_the_range(out_sybmbol)))     {         if (in_symbol == out_sybmbol)         {             return 0;         }         else         {             return 5;         }     }     else     {         if (((int)in_symbol + 32) == out_sybmbol || ((int)in_symbol - 32) == out_sybmbol)         {             return 5;         }         else         {             return 10;         }     }
    }   int main() {     char str[200] = { NULL };     const char word[6] = { 'S', 'a', 'n', 'd', 'r', 'o' };     int final_cost = 60, temp_cost = 0;     cin.get(str, 200);     list<char> temp;     list<char>::iterator ptr;     for (size_t i = 0; i < 6; i++)     {         temp.push_back(str[i]);     }     int j = 0;     for (size_t i = 6; i <= strlen(str); i++)     {         for (ptr=temp.begin(); ptr!=temp.end(); ptr++)         {             temp_cost += chance_one_symb(*ptr, word[j]);             if (temp_cost>=final_cost)             {                 break;             }             j++;         }         j = 0;         if (temp_cost < final_cost)         {             final_cost = temp_cost;         }         temp_cost = 0;         temp.pop_front();         temp.push_back(str[i]);         }     cout << final_cost;     return 0; }   Edited by author 14.07.2016 22:33 Seeing a similar code on other tasks previously, i can already tell the problem by intuition. Try something like <194 symbols>Sandro. i came to know about this very good russian site, e-maxx.ru... but i dont know russian, can anybody help how to read the content in english ? import java.util.*; public class N1068 {     public static void main(String[] args){         Scanner sc = new Scanner(System.in);         int n = sc.nextInt();           if ((n>=1)&&(n<10000)) System.out.print(n *(n + 1) / 2);         if ((n<1)&&(n>-10000)) System.out.print(-((-n) *(1 -n) / 2) + 1);     } }   что здесь не так? "Не превосходит" означает "меньше либо равно, но не больше"   Edited by author 19.07.2016 19:08 Could anybody give me this test please? Other tests are welcome as well :)   Edited by author 19.07.2016 15:33 I set condition to terminate program:   while (!halt) {     //bla bla bla     executed++;
      if (executed > MAX_EXECUTED)           terminate_program(); }   to   while (executed < MAX_EXECUTED && !halt) {      //bla bla bla      executed++; }   if (executed >= MAX_EXECUTED && !halt)     terminate_program();   It helps me and I got AC :)   Edited by author 16.07.2016 19:03   Edited by author 16.07.2016 19:04   Edited by author 16.07.2016 19:05 I am using dijkstra by adding a reverse edge of weight 1. Answer will be MIN ( Shortest distance, total_edges - shortest_distance);  |  
  |