Show all threads Hide all threads Show all messages Hide all messages |
If you have WA 9 due to recently added new tests | Smilodon_am [Obninsk INPE] | 1089. Verification with the Dictionary | 19 Nov 2022 16:01 | 1 |
Try below test with empty line as a text: --- start of input --- world # --- end of input --- Be careful, input in HEX can be presented as: 77 6F 72 6C 64 0D 0A 23 0D 0A 0D 0A The answer is: --- start of output --- 0 --- end of output --- Be careful about an empty line before 0. |
Problem 1089 "Verification with the Dictionary" has been rejudged | Vladimir Yakovlev (USU) | 1089. Verification with the Dictionary | 9 Jul 2022 16:58 | 1 |
The following changes have been made to the problem: - The checking program strictly checks that the initial formatting is preserved, for example it rejects outputs with additional empty lines before or after the text. - Missing limitations added to the problem statements: - The words in the text to correct are no longer than 16 characters. - The lines in the text to correct are no longer than 80 characters. - The cumulative length of all lines doesn't exceed 10000 characters. - New tests have been added. - Time limit has been reduced to 0.5 sec. - All solutions have been rejudged. 44% of authors have lost their accepted solutions. |
cpp ac code | Grigory 'Stargazer' Javadyan [RAU] | 1089. Verification with the Dictionary | 23 Dec 2016 21:49 | 3 |
cpp ac code Grigory 'Stargazer' Javadyan [RAU] 20 Oct 2008 16:02 #include <iostream> #include <vector> #include <string> int corrections = 0; bool words_match(const std::string& w1, const std::string& w2); void process_word(const std::vector<std::string>& dict, const std::string& word); int main(){ std::vector<std::string> dictionary; std::string curr_dict_word; std::getline(std::cin, curr_dict_word); while(curr_dict_word != "#"){ dictionary.push_back(curr_dict_word); std::getline(std::cin, curr_dict_word); } char c; std::string cword; while(std::cin.read(&c,1)){ if('a'<=c && 'z'>=c){ cword.insert(cword.end(), c); continue; } else if(!cword.empty()){ process_word(dictionary, cword); cword = ""; } std::cout << c; } if(!cword.empty()){ process_word(dictionary, cword); } std::cout << corrections << std::endl; return 0; } bool words_match(const std::string& w1, const std::string& w2){ if(w1.length() != w2.length()){ return false; } bool mismatch = false; for(int i = 0; i < w1.length(); ++i){ if(w1[i] != w2[i]){ if(mismatch){ return false; } mismatch = true; } } return mismatch; } void process_word(const std::vector<std::string>& dict, const std::string& word){ for(int i = 0; i < dict.size(); ++i){ if(words_match(dict[i], word)){ std::cout << dict[i]; ++corrections; return; } } std::cout << word; } Please don't post your solution here. |
To admins: not completely clear Russian problem statement | MVM | 1089. Verification with the Dictionary | 15 Jun 2015 09:00 | 2 |
It is said that text contains not more than 1000 words, but limitations on length of words exist (in statement) only for dictionary. It means that (technically) Russian statement does not bound length of text at all. So, can you tweak problem statement a bit to make it more clear, please? Edited by author 30.07.2014 20:05 +1 I agree, the statement isn't clear. You don't even know how much memory you're supposed to allocate for the text/words in the text. I just had to assume that the words weren't bigger than 1000 symbols. Anyway, now that I solved it and tested it, I can confirm that length of the words in the text doesn't exceed 8 symbols as well. |
Why is WA4?(Please help) | +riangle | 1089. Verification with the Dictionary | 9 Jul 2014 16:37 | 1 |
#include <iostream> #include <vector> #include <string> #include <cstring> #include <string.h> #include <fstream> using namespace std; struct our { char a[10]; }; char temp[10]; our V[105]; int SizeV; int main() { freopen("output.txt","w",stdout); freopen("input.txt","r",stdin); bool doit = true; int SizeV = -1; while(doit) if(strlen(temp) == 1 && temp[0] == '#') doit = false; else { ++SizeV; for(int k = 0; k < strlen(temp); k++) V[SizeV].a[k] = temp[k]; cin >> temp; } char a; char word[105]; int fails = 0; string s; getline(cin,s); char r; while(getline(cin,s)) { if(s.size() != 0) { int i = 0; char word[10]; while(i < s.size()) { int wordind = -1; while(s[i] >= 'a' && s[i] <= 'z') { word[++wordind] = s[i]; i++; } bool done = false; int nuz = 0; for(int j = 0; j <= SizeV; j++) { int error = 0; if((wordind+1) == strlen(V[j].a)) { for(int k = 0; k <= wordind; k++) if(word[k] != V[j].a[k]) { error++; if(error > 1) break; } if(error == 1) { done = true; nuz = j; fails++; break; } } } if(done) for(int e = 0; e < strlen(V[nuz].a); e++) cout << V[nuz].a[e]; else for(int e = 0; e <= wordind; e++) cout << word[e]; cout << s[i++]; } } cout << endl; } cout << fails << endl; fclose(stdin); fclose(stdin); return 0; } Edited by author 09.07.2014 20:44 |
Please, help me (JAVA), why WA 1? My prog gives right answer!! | KOTMAKRUS | 1089. Verification with the Dictionary | 7 Jul 2014 11:38 | 2 |
import java.io.*; public class TaskTimus { public static void main(String[] args) throws IOException { new TaskTimus().vvod(); }
String s = ""; String s1 = ""; String a[] = new String[120]; char c; int sch = -1, mistake = 0; String slovo = ""; int osh = 0; boolean bo = true; void vvod() throws IOException // INPUT THE DICTIONARY { BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); while (true) { slovo = r.readLine(); if ("#".equals(slovo)) break; sch++; a[sch] = slovo; } prov(); }
void prov() throws IOException //INPUT THE TEXT (FILE OR TIMUS CONSOLE) {
boolean oj = System.getProperty("ONLINE_JUDGE") != null; Reader reader = oj ? new InputStreamReader(System.in) : new FileReader("C:\\test.txt"); StreamTokenizer st = new StreamTokenizer(new BufferedReader(reader)); st.eolIsSignificant(true); st.wordChars(32,47); st.wordChars(58,64);
while (st.nextToken() != StreamTokenizer.TT_EOF) { if (st.ttype == StreamTokenizer.TT_WORD) s+=st.sval;
if (st.ttype == StreamTokenizer.TT_EOL) { analysis(); s = ""; } } if (s!="") analysis(); System.out.print(osh); // END OF INPUT, WRITE NUMBER OF MISTAKES }
void analysis() throws IOException // CHECK { StringReader sr = new StringReader(s); for (int i = 0; i < s.length(); i++) { c = (char) sr.read(); if (c <= 'z' && c >= 'a' || c <= 'Z' && c >= 'A') s1 += c; else mist();
} if (s1!="") mist(); System.out.println(); sr.close(); }
void mist() throws IOException // SEARCHING OF MISTAKE { for (int j = 0; j<=sch; j++) { if (a[j].length()==s1.length()) { for (int k = 0; k<s1.length(); k++) { if (a[j].charAt(k)!=s1.charAt(k)) mistake++; if (mistake>1) { mistake = 0; break; } } if (mistake == 1) { System.out.print(a[j]); if (!(c <= 'z' && c >= 'a' || c <= 'Z' && c >= 'A')) System.out.print(c); osh++; bo = false; mistake = 0; break; } } } if (bo) System.out.print(s1); if ( (!(c <= 'z' && c >= 'a' || c <= 'Z' && c >= 'A')) && bo) System.out.print(c); s1=""; bo = true; mistake = 0; } } Edited by author 08.07.2014 00:57 Did you check a problem with "enter" symbols that i said you? Because, I don't know how Stream Tokenizer works, and don't see fix for this in output mechanism. Maybe problem in this. |
WA#7? Why? | Prosto Misha | 1089. Verification with the Dictionary | 24 Jul 2013 00:25 | 2 |
Please give me test. Thank you! In the example test, please add the following three lines and give a try. "bbout to say" "countxy" should be "big' |
incorrect test # 4 | ₰ҟᾷѓßὂνṑγ (ONPU) | 1089. Verification with the Dictionary | 24 Jul 2013 00:22 | 3 |
it seems like test#4 includes big latin letters, but it's impossible according problem statement "все слова записаны в нижнем регистре, слово может содержать только латинские буквы от 'a' до 'z' (то есть «one-seventh» — это два слова — «one» и «seventh»)." admin, please check Requires to split the line into sequence of words, where word could be alphabet word or non-alphabet word. e.g., input: it ockupies ebout one-seventh of the earth's surfase. output: it[ ]ockupies[ ]ebout[ ]one[-]seventh[ ]of[ ]the[ ]earth[']s[ ]surfase[.] each bracketed word is non-alphabet and others are alphabet words. Edited by author 24.07.2013 00:23 Edited by author 24.07.2013 00:23 |
Buggy test data | Tony Beta Lambda | 1089. Verification with the Dictionary | 24 Feb 2012 16:33 | 2 |
It seems that in test case #7 there are more than 100 words in the vocabulary. This contradicts with the problem description and should be fixed. You are wrong. Vocabulary in the 7th test contains no more than 100 words. |
Please, help me WA #3 | HACKER | 1089. Verification with the Dictionary | 13 Jul 2011 12:16 | 1 |
what is wrong? var a:array[1..200] of string[8]; b:string; ch:char; n,n1,n2,k,i,j,g,p,gg:integer; begin n:=0; gg:=0; readln(b); p:=1; while b<>'#' do begin n:=n+1; a[n]:=b; readln(b); end; {$IFNDEF ONLINE_JUDGE} assign(input, 'input.txt'); reset(input); assign(output, 'output.txt'); rewrite(output); {$ENDIF} b:=''; while not eof(input) do begin read(input,ch); if ch in ['a'..'z'] then b:=b+ch else begin k:=0; for i:=1 to n do begin n1:=length(a[i]); n2:=length(b); if n1=n2 then begin g:=0; for j:=1 to n1 do if a[i][j]=b[j] then begin g:=g+1; end; if g=n1-1 then begin b:=a[i]; write(output,b); if p<>1 then write(output,ch); k:=1; gg:=gg+1; end; end; end; if k=0 then write(output,b,ch); b:=''; p:=2; end; end; writeln(output); write(output,gg); {$IFNDEF ONLINE_JUDGE} close(input); close(output); {$ENDIF} end. |
For people who get WA ! There are some common mistakes | Phan Hoài Nam - Đại học Ngoại ngữ Tin Học TP.HCM | 1089. Verification with the Dictionary | 10 Apr 2011 03:43 | 4 |
1. Do not check special characters such as '.' ','... only check characters 'a' - 'z' or 'A' - 'Z' for example: b # a. cd. . output: b. cd. . 2. Do not check equal strings for example: world # world world world output: world world world 0 3. Do not check strings having different length Edited by author 12.07.2010 15:50 Edited by author 12.07.2010 15:51 >>3. Do not check strings having different length I always had WA 2! WTF I thought... but when I did as you said - I got AC. Authors should fix this problem... 'Your teacher must have forgotten that her pupils sometimes forget to write letters and even sometimes they write extra letters - excellent!' So its wrong I think... input: hello # hekllo my dear andrew! output should be: hello my dear andrew! 1 but instead we have: hekllo my dear andrew! 0 Am I wrong? Edited by author 18.07.2010 18:51 yep! just checked again! WA 2. 3102765 19:03:16 18 июл 2010 Andrew Shmig aka SKYDOS [Vladimir SU] 1089 C# Wrong answer 2 0.109 973 КБ Edited by author 18.07.2010 19:04 I support Andrew Shmig. This ambiguity in problem statement should be fixed. Really, since pupils can add extra-letters, word "probleme" with extra "e" in it's end is written with 1 mistake. problem is correct, when it is talking about extra-chars-mistakes - it is about not to check it, because teacher forgot this! so your program shouldn't do that, teacher do not want this functionality ) |
Separators | szczepi | 1089. Verification with the Dictionary | 13 Nov 2010 14:20 | 1 |
A separator is a character which isn't a small latin letter. |
Some comments | AlainDelon | 1089. Verification with the Dictionary | 3 Jul 2010 18:44 | 2 |
I used two suffix array which contains sorted dictionary words something need to take care: 1.if the readed word's lengh is within [1, 8] 2.if you found one in dictionary, make sure they have the same length and exact one letter different 3.The word readed in may contains only a single character |
why WA#7??? Give me test!!! | tester | 1089. Verification with the Dictionary | 2 Nov 2009 04:10 | 2 |
#include <stdio.h> #include <string.h> struct problem_1089 { char word[10]; int len; }; problem_1089 slovar[100] = {}; int n = 0; bool flag = false; char c; char str[1001] = {}; int len = 0; int count = 0; void check() { for (int i = 0; i < n; i++) { if (slovar[i].len == len) { int error = 0; for (int j = 0; j < len; j++) { if (str[j] != slovar[i].word[j]) error++; if (error > 1) break; } if (error == 1) { strcpy (str,slovar[i].word); count++; return; } } } return; } int main () { //freopen ("input.txt","r",stdin); //freopen ("output.txt","w",stdout); while (!flag) { gets(slovar[n++].word); slovar[n - 1].len = strlen (slovar[n - 1].word); if (strcmp(slovar[n - 1].word,"#") == 0) { flag = true; slovar[--n].word[0] = '\0'; slovar[n].len = 0; } } bool perevod = false; while (scanf ("%c", &c) != EOF) { flag = false; if (c > 96 && c < 123) str[len++] = c; else { check(); for (int i = 0; i < len; i++) printf ("%c", str[i]); if (c == '\n') perevod = true; else perevod = false; printf ("%c", c); len = 0; }
} if (len > 0) perevod = false; check(); for (int i = 0; i < len; i++) printf ("%c", str[i]); if (!perevod && !flag) printf ("\n%d", count); else printf ("%d", count); return 0; } Hi, There can be more than 100 words in the vocabulary so don't read just first 100 words instead just read everything till you encounter # Varun |
Use 'eof' to stop your program | Roby | 1089. Verification with the Dictionary | 29 Jan 2009 13:17 | 2 |
if there is a empty line , don't stop your program. That's real advise! For the input: ___________ try # try try try. ~~~~~~~~~~~ Correct is the output ___________ try try try. 0 ~~~~~~~~~~~ as well, so don't bother yourself to avoid the last empty line. Contrary, i've lost a lot of time with it. Stop at EOF, not at double empty line! |
If you got WA,there are something that should pay attention! | xing | 1089. Verification with the Dictionary | 16 Oct 2008 18:24 | 7 |
1.There is one empty line in the end of text. You should not output this line. But there are maybe some empty lines in the middle of text, you should output these lines. 2.The lenght of words in the vocabulary may be larger than 8,the total of words in the vocabulary may be exceed 100. > 1.There is one empty line in the end of text. You should not output > this line. But there are maybe some empty lines in the middle of > text, you should output these lines. > > 2.The lenght of words in the vocabulary may be larger than 8,the total > of words in the vocabulary may be exceed 100. I think, for the second point, you are refering to the text body rather than the vocabulary list. am i right? case: -------- pencil # pencii-box penc-ii pencii'box pen'cii -------- What is the output? pencil-box penc-ii pencil'box pen'cii 2 ... which you should pay atantion to input: try # try try try output: try try try 0 it was very useful! thx a lot! *** 1.There is one empty line in the end of text. You should not output this line. But there are maybe some empty lines in the middle of text, you should output these lines. *** 2.The lenght of words in the vocabulary may be larger than 8,the total of words in the vocabulary may be exceed 100. (*******************************************************) THESE TWO TIPS ARE BULL SHIT !!!! when i solve this task then i don't care about last empty line and i have a dictionary on 100 words with length of 8 symbols. there is my dictionary decription: var dic: array [1..100] of string[8]; Edited by author 23.07.2005 22:38 |
Корректное условие/Correct problem | Alen Pelin | 1089. Verification with the Dictionary | 29 Apr 2008 18:09 | 1 |
Читая различные обсуждения этой задачи, я нашел множество отклонений от условия... Так давайте верно переформулируем условие задачи! On reading posts about the problem, i've found many mistakes in defination... Lets make the defination correct! |
hint to AC | Anupam Ghosh,Bengal Engg and Sc Uni,PDSIT,Shibpur,India | 1089. Verification with the Dictionary | 4 Mar 2008 13:47 | 1 |
hint to AC Anupam Ghosh,Bengal Engg and Sc Uni,PDSIT,Shibpur,India 4 Mar 2008 13:47 store all words in 2d array. the text in second 1d array.now read words one by one.compare each word with available match differing just by one letter.if words are mismatching by more than one letter or words belong to vocab then no need to change the text else change the text with word in vocab. best of luck!! |
Can anyone tell me where is mistake? | Madiyar Tursunbayev | 1089. Verification with the Dictionary | 30 Jan 2008 02:34 | 2 |
I solved this problem, but my program is wrong at 4 test. Where is mistake? var l,k,j,m,n,mistake,o,sum,p,w:integer; text1:string; z,text:array[1..100]of string; begin o:=1; repeat inc(l); readln(z[l]); until z[l]='#'; dec(l); repeat inc(j); readln(text[j]); until text[j]=''; dec(j); for k:=1 to l do for m:=1 to j do begin for n:=1 to length(text[m]) do begin text1:=''; while text[m][o] in ['a'..'z'] do begin text1:=text1+text[m][o]; inc(o); end; if length(text1)=length(z[k]) then begin for w:=1 to length(z[k]) do if text1[w]<>z[k][w] then inc(mistake); if mistake=1 then begin inc(sum); for p:=1 to length(z[k]) do begin text[m][o-length(text1)+p-1]:=z[k][p]; end; end; mistake:=0; end; inc(o); end; o:=1; (*----------------------*) end; for k:=1 to j do writeln(text[k]); writeln(sum); end. I also have WA 4. Does anybody know what is wrong with it? |
Here is my hint (WA#2) | Alexey Procenko | 1089. Verification with the Dictionary | 13 Dec 2007 01:21 | 1 |
I've got WA#2 many times while i did not compare the length of tested word with the length of word in the vocabulary. So, i used strcmp() function and get AC in 0.001 sec with 124 KB of memory. |