Page 1 of 2

Judge not judging (11849 - CD)

Posted: Sat Apr 23, 2011 1:03 pm
by ggaammeerr
Hello,

My problem is that I have not received verdicts for submissions I made 2 days ago (April 21). I have tried resubmitting yesterday and it didn't work either. I guess the judge is working fine because if I check the last 50 submissions, I can see very recent submissions on the top of the list. It's just that my submissions aren't judged for some reason. Could you please look into it? My UVa username is the same as on this forum (ggaammeerr).

Many thanks.

11849 CD ---Why RTE Please help me, please.

Posted: Wed Dec 14, 2011 3:54 pm
by opo
Here is my Code.

Code: Select all

/*Removed Code */

11849 runtime error

Posted: Mon Jan 09, 2012 8:52 am
by zhaoyangbt110
can somebody pls help me?

I always got runtime error.

Code: Select all

import java.util.ArrayList;
import java.util.Scanner;
import java.util.TreeMap;


class cd {
	public cd(){
		
	}
	
	public static void main(String args[]){
        cd c = new cd();
		ArrayList<Long> answer = new ArrayList<Long>();
		TreeMap <Long,Integer> map = new TreeMap<Long,Integer>();
		Scanner sc = new Scanner (System.in);
		int jack=0,jill=0;
		long num=0;
		Long index= 0L;
		jack = sc.nextInt();
		jill = sc.nextInt();
		while(jack!=0|jill!=0){
			num=0;
			index=0L;
			for(int i=0;i<jack;i++){
				index = sc.nextLong();
				if(map.get(index)==null)
					map.put(index, 1);
				else{
					int t = map.get(index)+1;
					map.put(index, t);
				}
			}
			for(int j=0;j<jill;j++){
				index = sc.nextLong();
				if(map.get(index)!=null&&map.get(index)==1)
					num = num+1;
				else if(map.get(index)!=null&&map.get(index)>1){
					num = num + map.get(index);
					map.put(index, 1);
				}
			}
			answer.add(num);
			jack = sc.nextInt();
			jill = sc.nextInt(); 
		}
		for(int i=0;i<answer.size();i++)
			System.out.println(answer.get(i));
	}
	
}

Thanks!

sample test cases 11849 cd

Posted: Tue Jan 10, 2012 8:11 pm
by sudkh
Hi,
I think my solution to the above problem is correct but the judge keeps on saying that it is wrong. anyone got any sample test cases i can try with output apart from the one on the website

Re: 11849 CD ---Why WA Please help me, please.

Posted: Fri Jan 13, 2012 6:39 am
by uvasarker
I am getting WA in 11849 - CD
Please, give me some critical test cases so that I would get rid of this problem. Please
Here, is my code

Code: Select all

#include <cstdio>
#include <vector>
#include <iostream>
using namespace std;

int main()
{
	long long n,m;
	while(scanf("%lld %lld",&n,&m)==2)
	{
		 vector <long long> jak, jill;
		if(n==0 && m==0) break;
		long long JA, JI;
		
		for(long long i=0 ; i<n ; i++)
		{
			scanf("%lld",&JA);
			jak.push_back(JA);
		}

		for(long long i=0 ; i<m ; i++)
		{
			scanf("%lld",&JI);
			jill.push_back(JI);
		}
		long long temp=0,sell=0;
		
		if(m>n)
		{
				for(long long i=0 ; i<jill.size() ; i++)
				{
						temp=jill[i];
						for(long long j=0 ; j<jak.size() ; j++)
						{
								if(jak[j]==temp)
								{
										sell++;
								}
								else if(temp>jak[j]) break;
						}
						if(jill[i]>jak[n-1])  break;
				}
		}
		else
		{				
				for(long long i=0 ; i<jak.size() ; i++)
				{
						temp=jak[i];
						for(long long j=0 ; j<jill.size() ; j++)
						{
								if(jill[j]==temp)
								{
										sell++;
								}
								else if(temp>jill[j]) break;
						}
						if(jak[i]>jill[m-1])  break;
				}
		}
		
		printf("%lld\n",sell);
	}
	return 0;	
}


Re: 11849 CD ---Why RTE Please help me, please.

Posted: Sat Jan 14, 2012 1:49 am
by brianfry713
Try the sample input.

Re: 11849 CD ---Why RTE Please help me, please.

Posted: Thu Jan 19, 2012 7:54 pm
by uvasarker
Hi brother,
Now, I got TLE
Here is my code:

Code: Select all

    #include <cstdio>
    #include <vector>
    #include <iostream>
    using namespace std;

    int main()
    {
       long long n,m;
       while(scanf("%lld %lld",&n,&m)==2)
       {
           vector <long long> jak, jill;
          if(n==0 && m==0) break;
          long long JA, JI;
          
          for(long long i=0 ; i<n ; i++)
          {
             scanf("%lld",&JA);
             jak.push_back(JA);
          }

          for(long long i=0 ; i<m ; i++)
          {
             scanf("%lld",&JI);
             jill.push_back(JI);
          }
          long long sjak=jak.size(), sjil=jill.size();
          long long temp=0,sell=0;
          
          if(m>n)
          {
                for(long long i=0 ; i<sjil ; i++)
                {
                      temp=jill[i];
                      for(long long j=0 ; j<sjak ; j++)
                      {
                            if(jak[j]==temp)
                            {
                                  sell++;
                            }
                            else if(jak[j]>temp) break;
                      }
                      if(jill[i]>jak[n-1])  break;
                }
          }
          else
          {            
                for(long long i=0 ; i<jak.size() ; i++)
                {
                      temp=jak[i];
                      for(long long j=0 ; j<jill.size() ; j++)
                      {
                            if(jill[j]==temp)
                            {
                                  sell++;
                            }
                            else if(jill[j]>temp) break;
                      }
                      if(jak[i]>jill[m-1])  break;
                }
          }
          
          printf("%lld\n",sell);
       }
       return 0;   
    }



Re: 11849 CD ---Why RTE Please help me, please.

Posted: Wed Jan 25, 2012 1:46 am
by brianfry713
You're searching the entire Jack array for every CD Jill has. Speed it up by taking advantage of the fact that the inputs are already sorted.

Re: sample test cases 11849 cd

Posted: Wed Jan 25, 2012 1:50 am
by brianfry713
input:

Code: Select all

3 3
1
2
3
1
2
4
10 10
2
4
6
8
10
12
14
16
18
20
1
3
5
7
9
11
13
15
17
19
10 10
2
4
6
8
10
12
14
16
18
20
2
4
6
8
10
12
14
16
18
20
10 10
2
5
6
9
10
13
14
17
18
21
2
4
6
8
10
12
14
16
18
20
0 0
Output:

Code: Select all

2
0
10
5

Re: 11849 CD ---Why RTE Please help me, please.

Posted: Sat Jan 28, 2012 7:26 pm
by uvasarker
Hi,
Brother
Thanks a lots.
Thanks a lots.
Thanks a lots.
Finally I got it ACCCCCCCCCCCC.

Re: 11849 CD ---Why RTE Please help me, please.

Posted: Thu May 03, 2012 10:31 pm
by Achilies_Saiful_Buet
plz help me understanding this.this code below is getting TLE

Code: Select all

#include<iostream>
#include<cstdio>
#include<map>

using namespace std;
int main()
{
    //freopen("11849in.txt","r",stdin);
    long long int n,m,i,j,count;
     int x;
    map<long int,int>mp;

    while(cin>>n>>m && !(n==0 && m==0))
    {
        mp.clear();
        count=0;
        for(i=0;i<n;i++){cin>>x;mp[x]=1;}
        for(i=0;i<m;i++){cin>>x;if(mp[x]==1)count++;}
        cout<<count<<endl;
    }

}
but this is not--

Code: Select all


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <vector>
#include <stack>
#include <string>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#define pb push_back
#define MAX 1000000
using namespace std;
int main()
{ long long int n,m;
while(scanf("%lld %lld",&n,&m)&& (n ||m))
{ int a,val=0;
map <int,int> check;
for(long long int i=1;i<=n;i++)
{
scanf("%d",&a);
check[a]=1;
}
for(long long int i=1;i<=m;i++)
{
scanf("%d",&a);
if(check[a]==1)
val++;

}
cout<<val<<endl;
}

return 0;
}
why???

Re: 11849 CD ---Why RTE Please help me, please.

Posted: Fri May 04, 2012 9:17 pm
by brianfry713
scanf is faster than cin.

Re: 11849 CD ---Why RTE Please help me, please.

Posted: Sat Jun 16, 2012 12:59 pm
by Evan72

Code: Select all

#include<stdio.h>
removed after AC

Re: 11849 CD ---Why RTE Please help me, please.

Posted: Tue Jun 19, 2012 12:04 am
by brianfry713
Each catalog number is a positive integer no greater than one billion.

Re: 11849 CD ---Why RTE Please help me, please.

Posted: Mon Jul 02, 2012 11:52 pm
by Evan72
brianfry713 wrote:Each catalog number is a positive integer no greater than one billion.
Thank you :)