| Show all threads Hide all threads Show all messages Hide all messages |
| Empty lines in test | LostInSpace | 1563. Bayan | 17 Jul 2013 18:20 | 3 |
I'm pass test only after add ignoring for empty input lines. why empty lines present in tests? There is no empty lines in tests. But the input is finished by EOLN, as usual on Timus Online Judge. Edited by author 17.07.2013 18:22 |
| Some tests for ... | Oleg Strekalovsky aka OSt [Vologda SPU] | 1102. Strange Dialog | 17 Jul 2013 10:23 | 6 |
May be this tests will help to some others. When my prog passed all of them , I'v get AC. 12 putone inputon outputoutputinputon inputone putin outputin puton inonputin oneputonininputoutoutput oneininputwooutoutput outpu utput Answers: NO YES YES YES NO YES YES NO YES NO NO NO "putin" is the best test. =) And you forgot to tell about copyrights of this test =)))) It is possible to read data without MLE (Thanks to Fyodor Menshikov) and TLE (Thanks to Alex Tolstov ). And make very-very-simple DFA by reading from end to the begining of data string. If you will read "As is" you will have some problems with creating DFA :) My AC program using this "back reading" in Java works 0.625 s And use 10 390 КБ Good luck! Edited by author 29.07.2009 19:37 Hello, how does your programm do back reading? Can you post that part of your program? Hello, how does your programm do back reading? Can you post that part of your program? Just one char array of 10^7 of chars with "reused" for reading lines of char. Use BufferedReader to read bytes from input. Not Scanner. Edited by author 19.07.2012 03:10Thanks, man. You helped me to fix some problems in my state/event table :) People, be afraid of mistyping! |
| W.A. on the 6 test!!!! | Ivan | 1210. Kind Spirits | 16 Jul 2013 17:55 | 2 |
Give me sixth test, please!!! i also have WA on 6 test, please, give me some tests. |
| WA 27 | moji | 1772. Ski-Trails for Robots | 16 Jul 2013 08:52 | 2 |
WA 27 moji 16 Jul 2013 08:42 very usual segment tree, that helps to fill dynamic vars. I wonder if anyone have been had the same problem... help! found it; I wasn't careful about the length of the array. Edited by author 16.07.2013 08:53 Edited by author 16.07.2013 08:53 |
| Careful with the i/o system u use for test N#5 | HeypaBHoBeceH | 1502. Domino Dots | 16 Jul 2013 05:10 | 3 |
I didn't get accepted until I switched printf() with cout. I used %lld for the format of printf and still it got WA. Same formula, same code, just that i used cout/cin and I got AC. I used printf with "%llu" and got AC the first attempt. u - unsigned d - digit (signed) |
| be carefull | sobhan_cp | 1145. Rope in the Labyrinth | 15 Jul 2013 18:51 | 1 |
cin>>n>>m not while(cin>>n>>m) |
| RE test#11 | zhuchenxi | 1542. Autocompletion | 15 Jul 2013 18:32 | 1 |
why?? #include<cstdio> #include<algorithm> #include<iostream> #include<cmath> #include<climits> #include<string> #include<string.h> #include<vector> #define sf scanf #define pf printf #define cls(a) memset(a,0,sizeof(a)) #define _cls(a) memset(a,-1,sizeof(a)) using namespace std; struct Edge_t{ int to,next; }edge[400000]; int hed[200000]; int et; struct tree{ tree *br[26]; vector<int>vec; tree(){ for(int i=0;i<26;++i) br[i]=NULL; vec.clear(); } }; struct Input{ char str[18]; int val; }inp[100010]; tree *head; inline void adde(int u,int v){ edge[et].to=v,edge[et].next=hed[u],hed[u]=et++; } inline void addtree(char *st,int index){ int id,i; tree *s=head; for(i=0;st[i];++i){ id=st[i]-'a'; if(!s->br[id]) s->br[id]=new tree; s=s->br[id]; } s->vec.push_back(index); } inline bool cmp(int a,int b){ if(inp[a].val==inp[b].val) return strcmp(inp[a].str,inp[b].str)<0; return inp[a].val>inp[b].val; } void DEL(tree *s){ int i; for(i=0;i<26;++i) if(s->br[i]) DEL(s->br[i]); s->vec.clear(); delete(s); } int res[1000010]; void deal(char *st,int index){ int i,id,j; tree *s=head; for(i=0;st[i];++i){ id=st[i]-'a'; if(!s->br[id]) return; s=s->br[id]; for(j=0;j<s->vec.size();++j) adde(s->vec[j],index); } } int main(){ int i,j; int n,m,sk; char str[18]; while(scanf("%d",&n)!=EOF){ head=new tree; _cls(hed); for(i=et=0;i<n;++i) sf("%s%d",inp[i].str,&inp[i].val); sf("%d",&m); for(j=0;j<m;++j){ sf("%s",str); addtree(str,j); } for(i=0;i<n;++i) deal(inp[i].str,i); int e; for(i=0;i<m;++i){ if(i) puts(""); for(sk=0,e=hed[i];e!=-1;e=edge[e].next) res[sk++]=edge[e].to; if(!sk) continue; sort(res,res+sk,cmp); //if(sk>0) for(j=0;j<sk && j<10;++j) pf("%s\n",inp[res[j]].str); } DEL(head); } return 0; } /* 2 ab 10 ac 20 1 f */ |
| Failing in test 9 | Iman Akbari | 1001. Reverse Root | 15 Jul 2013 18:30 | 2 |
after an hour of realizing how to receive the inputs, here I am failing at test 9. the code looks right to me any ideas? import java.util.*; import java.io.*; public class lucky {
public static void main(String[] args) throws IOException{
BufferedReader cin = new BufferedReader(new InputStreamReader(System.in));
double[] ans=new double[64000];
int n=0; StringTokenizer st; while (true) try{
st=new StringTokenizer(cin.readLine()); while (st.hasMoreTokens()){ ans[n]=java.lang.Math.sqrt(Double.parseDouble(st.nextToken()));
n++; } //System.out.println("log");
if (!cin.ready()) throw new Exception();
} catch (Exception ex) {break;}
n--; for(; n>=0; n--) System.out.printf("%.5f\n", ans[n]); }
} The input stream is said to be 256KB at maximum, which means it can have 131072 numbers at maximum, if a KB is meant to be 1024 bytes. But you output no more than 64000 numbers. So I assume your program fails on inputs with many numbers. |
| why it doesn't work??? help to write on c++! | Ilya_novichok | 1001. Reverse Root | 15 Jul 2013 18:05 | 2 |
#include <iostream> #include <cstdio> using namespace std; int main() { double *n = new double[1000]; double *m = new double[1000]; int l=0; int r=0; while(getchar() != EOF) { scanf("%lf",&n[l]); l++; } for(r=l; r>0; r--) { m[r]=sqrt(n[r]); cout << m[r]; } } Вот на основе твоего кода. массив m мне кажется лишний здесь. getchar "съедал" символ. cout выводит без заданной точности. #include <iostream> #include <math.h> using namespace std; int main() { double *n = new double[10000000]; double buf; int l=0; while(scanf("%lf",&buf) != EOF) n[l++]= sqrt(buf); l-=1; while (l>=0) printf("%.4f\n",n[l--]); } |
| 1106 two teams | Smentalp | 1106. Two Teams | 14 Jul 2013 19:22 | 1 |
it's not standard problem |
| wa in test #1 | Roman | 1079. Maximum | 14 Jul 2013 18:30 | 1 |
input: 5 10 0 output: 3 4 what is wrong? |
| that is not like a computer in my code? | viktorius | 1585. Penguins | 14 Jul 2013 02:48 | 2 |
#include<stdio.h> #include<string.h> int comp(char *pen,char *peng) { int i; for(i=0;i<strlen(pen);i++) if(pen[i]!=peng[i]) return 0; return 1; } int main() { int i,a=0,b=0,c=0,n; char pen[3][10]={"Emperor","Little","Macaroni"},peng[20]; scanf("%d",&n); for(i=0;i<n;i++) { fflush(stdin); gets(peng); if(comp(pen[0],peng)) ++a; if(comp(pen[1],peng)) ++b; if(comp(pen[2],peng)) ++c; } if(a>b&&a>c) printf("Emperor Penguin"); if(b>a&&b>c) printf("Little Penguin"); if(c>b&&c>a) printf("Macaroni Penguin"); return 0; } figured out, you need to clear the buffer perverted by scanf ("% * [^ \ n] "); and used to enter the scanf ("% s ", peng); |
| Twice-registered, what to do ? | Leo | | 14 Jul 2013 01:41 | 1 |
Dear admins, My JUDGE_IDs: 146419HS, 146556GN. Please remove me one of them. And tell me about ID, which I stayed. leofun01@hotmail.com |
| gcc vs ms vc | ssau_nazarov_yuriy_pavlovich | 1336. Problem of Ben Betsalel | 12 Jul 2013 19:50 | 2 |
#include <stdio.h> int main(){ long long int t; scanf("%lld", &t); printf("%lld\n%lld", t*t, t); return 0; } AC with MS VC, but WA 1 with GCC. Can anybody explain me what's wrong with my code? u should use %i64d instead %lld with GCC ;) Edited by author 12.07.2013 19:50 |
| please help me! Memory limit exceeded | Mariana | 1102. Strange Dialog | 12 Jul 2013 17:35 | 4 |
#include <iostream> #include <cstdlib> #include <stdio.h> //#pragma comment(linker, "/STACK:16777216")
using namespace std; int flag=0; int flag1=0; char *a = new char [10000001]; int f(int pos,int flag,int n){ int l=0; if ((pos==n+1) && (flag==1)) {std::cout<<"YES"<<endl; flag1=1; return 0;} if ((pos==n+1) && (flag==0)) {} else if (pos<=n){ {if ((a[pos]=='o') && (a[pos+1]=='u') && (a[pos+2]=='t') && (a[pos+3]=='p') && (a[pos+4]=='u') && (a[pos+5]=='t')) {f(pos+6,1,n);l=1;} if ((a[pos]=='i') && (a[pos+1]=='n') && (a[pos+2]=='p') && (a[pos+3]=='u') && (a[pos+4]=='t')) {f(pos+5,1,n);l=1;} if ((a[pos]=='p') && (a[pos+1]=='u') && (a[pos+2]=='t') && (a[pos+3]=='o') && (a[pos+4]=='n')) {f(pos+5,1,n);l=1;} if ((a[pos]=='o') && (a[pos+1]=='u') && (a[pos+2]=='t')) {f(pos+3,1,n);l=1;} if ((a[pos]=='o') && (a[pos+1]=='n') && (a[pos+2]=='e')) {f(pos+3,1,n);l=1;} if ((a[pos]=='i') && (a[pos+1]=='n')) {f(pos+2,1,n);l=1;} if (l==0) {} }} }
int main() { int k=0,n=0,j=0; int i=0; std::cin>>k; char c; for (j=1;j<=k+1;j++) { i=0; flag1=0; while (((c = getchar()) != '\n') ) {a[i]=c;i++;} n=i-1;
if (n>0) { f(0,0,n); if (flag1==0) std::cout<<"NO"<<endl;}
}
} Edited by author 11.07.2013 23:48 Edited by author 11.07.2013 23:49 #include <iostream> #include <cstdlib> #include <stdio.h> #include <string> #include <cstring> using namespace std; int flag=0; int flag1=0; char *a = new char [10000000]; int main() { int k=0,n=0,j=0,l=0; int i=0,pos=0; std::cin>>k; char c; for (j=1;j<=k+1;j++) { i=0; l=0; gets(a); n=strlen(a);n--;
if (n>0){
pos=n;
while (pos>0){ if ((a[pos]=='t') && (a[pos-1]=='u') && (a[pos-2]=='p') && (a[pos-3]=='t') && (a[pos-4]=='u') && (a[pos-5]=='o')) {l=1;pos=pos-6;} if ((a[pos]=='t') && (a[pos-1]=='u') && (a[pos-2]=='p') && (a[pos-3]=='n') && (a[pos-4]=='i')) {l=1;pos=pos-5;} if ((a[pos]=='n') && (a[pos-1]=='o') && (a[pos-2]=='t') && (a[pos-3]=='u') && (a[pos-4]=='p')) {l=1;pos=pos-5;} if ((a[pos]=='t') && (a[pos-1]=='u') && (a[pos-2]=='o')) {l=1;pos=pos-3;} if ((a[pos]=='e') && (a[pos-1]=='n') && (a[pos-2]=='o')) {l=1;pos=pos-3;} if ((a[pos]=='n') && (a[pos-1]=='i')) {l=1;pos=pos-2;} if (l==0) {break;} } if (l==1) std::cout<<"YES"; else std::cout<<"NO"; }}
delete [] a; } Don't read the whole file (and even line!) into memory - each time you need only the last and previous words - so, this problem is solvable in O(1) memory |
| Why are these tests? | Sasha | 1139. City Blocks | 12 Jul 2013 17:01 | 2 |
4 3 - 4 3 3 - 2 Is it not true 4 3 - 6, 3 3 - 3? Read the statement carefully: M and N are the number of streets, which encompass M-1 and N-1 blocks. |
| WA2 | SazanovSasha | 1201. Which Day Is It? | 12 Jul 2013 15:37 | 2 |
WA2 SazanovSasha 12 Jul 2013 15:32 I have WA2, but I don't know why. What a trick in test 2? Or can you give me some tricky tests? Re: WA2 SazanovSasha 12 Jul 2013 15:37 My mistake. I forgot to comment out the line. |
| умереть не встать WA1 | FlashKa | 1004. Sightseeing Trip | 11 Jul 2013 17:07 | 1 |
заменил std::ends на ' ' и сразу "Accepted" ну как так можно? Edited by author 11.07.2013 17:18 |
| WA #21 | bladeandsoul | 1917. Titan Ruins: Deadly Accuracy | 11 Jul 2013 12:53 | 1 |
WA #21 bladeandsoul 11 Jul 2013 12:53 what is it? plz // Deadly Accuracy.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <algorithm> using namespace std; int n=0,p=0; int counter[1000001]={0}; int main() { cin>>n>>p; int a=0; int maxCoins=0; int timeOfAttack=0;
for (int i=0;i<n;i++){ cin>>a; counter[a]++; }
int tempR=0; int tempCoin=0; for (int i=1;i<=p && i<=1000000;i++) { if (i*counter[i]<=p && counter[i]!=0) {
if (i*(tempCoin+counter[i])>p) { if (tempR<=p && tempCoin!=0 &&tempR !=0){ timeOfAttack++; maxCoins+=tempCoin; } tempCoin=counter[i];
} else tempCoin+=counter[i]; tempR=i*tempCoin; } } if (tempR<=p && tempCoin!=0 &&tempR !=0) { timeOfAttack++; maxCoins+=tempCoin; }
cout<<maxCoins<<' '<<timeOfAttack<<endl; cin>>a; return 0; } |
| Acepted soL | klo | 1394. Ships. Version 2 | 9 Jul 2013 17:14 | 1 |
HA Edited by author 09.07.2013 17:16 Edited by author 09.07.2013 17:16 Edited by author 09.07.2013 17:17 Edited by author 09.07.2013 17:19 |