11849 - CD
Moderator: Board moderators
-
- New poster
- Posts: 3
- Joined: Sat Nov 15, 2008 6:26 pm
- Location: EU
Judge not judging (11849 - CD)
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.
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.
The beauty of programming lies in simplicity.
11849 CD ---Why RTE Please help me, please.
Here is my Code.
Code: Select all
/*Removed Code */
Last edited by opo on Fri Jan 13, 2012 7:03 am, edited 1 time in total.
-
- New poster
- Posts: 1
- Joined: Mon Jan 09, 2012 8:48 am
11849 runtime error
can somebody pls help me?
I always got runtime error.
Thanks!
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));
}
}
sample test cases 11849 cd
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
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
-
- Learning poster
- Posts: 96
- Joined: Tue Jul 19, 2011 12:19 pm
- Location: Dhaka, Bangladesh
- Contact:
Re: 11849 CD ---Why WA Please help me, please.
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
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;
}
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11849 CD ---Why RTE Please help me, please.
Try the sample input.
Check input and AC output for thousands of problems on uDebug!
-
- Learning poster
- Posts: 96
- Joined: Tue Jul 19, 2011 12:19 pm
- Location: Dhaka, Bangladesh
- Contact:
Re: 11849 CD ---Why RTE Please help me, please.
Hi brother,
Now, I got TLE
Here is my code:
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;
}
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11849 CD ---Why RTE Please help me, please.
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.
Check input and AC output for thousands of problems on uDebug!
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: sample test cases 11849 cd
input:
Output:
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
Code: Select all
2
0
10
5
Check input and AC output for thousands of problems on uDebug!
-
- Learning poster
- Posts: 96
- Joined: Tue Jul 19, 2011 12:19 pm
- Location: Dhaka, Bangladesh
- Contact:
Re: 11849 CD ---Why RTE Please help me, please.
Hi,
Brother
Thanks a lots.
Thanks a lots.
Thanks a lots.
Finally I got it ACCCCCCCCCCCC.
Brother
Thanks a lots.
Thanks a lots.
Thanks a lots.
Finally I got it ACCCCCCCCCCCC.
-
- New poster
- Posts: 16
- Joined: Wed Mar 28, 2012 7:24 pm
- Location: Dhaka,Bangladesh
Re: 11849 CD ---Why RTE Please help me, please.
plz help me understanding this.this code below is getting TLE
but this is not-- why???
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;
}
}
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;
}
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11849 CD ---Why RTE Please help me, please.
scanf is faster than cin.
Check input and AC output for thousands of problems on uDebug!
Re: 11849 CD ---Why RTE Please help me, please.
Code: Select all
#include<stdio.h>
removed after AC
Last edited by Evan72 on Mon Jul 02, 2012 11:54 pm, edited 1 time in total.
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11849 CD ---Why RTE Please help me, please.
Each catalog number is a positive integer no greater than one billion.
Check input and AC output for thousands of problems on uDebug!
Re: 11849 CD ---Why RTE Please help me, please.
Thank youbrianfry713 wrote:Each catalog number is a positive integer no greater than one billion.
![:)](./images/smilies/icon_smile.gif)