Re: [algogeeks] LOGIC!!!

2012-08-30 Thread Saurabh Kumar
I think, if the Graph is 2-colorable (i.e. Bipartite) trip can be arranged.

On 30 August 2012 09:43, ashish mann ashishman...@gmail.com wrote:

 Q. A company organizes two foreign trips for its employees yearly. Aim of
 the trip is to increase interaction among the employees of the company and
 hence company wants each of his employee to see new people on the trip and
 not even a single person with whom he has worked in past. Therefore it is a
 rule in company that in any of the trips, all the employees should be new
 to each other and no two of them should have worked together in past.


 Given the work history of each employee (which people he has worked with
 sometimes in past), you have to tell whether all of the employees can be
 accommodated within trips without violating the above rule or not. Each
 employee is given a unique integer ID by which they are recognized. You can
 also assume that each employee has worked with at least one other employee
 in past.



 *Note: *No employee can be in both trips and every employee must be part
 of one trip.


 *Example: *

 i) Suppose the work history is given as follows: {(1,2),(2,3),(3,4)}; then
 it is possible to accommodate all the four employees in two trips (one trip
 consisting of employees 1 3 and other having employees 2  4). Neither of
 the two employees in the same trip have worked together in past.

 ii) Suppose the work history is given as {(1,2),(1,3),(2,3)} then there is
 no way possible to have two trips satisfying the company rule and
 accommodating all the employees.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] logic???????????

2011-08-13 Thread WgpShashank
@Sagar Dude , oh common shashank...its not that easy u told. I Hope 
You Understand the question properly ? or you are talking about *bitonic 
sequence*  if not then  just point the obvious or no-obvious bug in above 
algorithm, Same Algo is coded below by Yasir, also Kunal Also suggested some 
improvement to reduce the number instruction , i don't think anything wrong 
in the algorithm ??

Just Check The Code ,Still  if anything wrong do notify me , i will 
seriously look at that again ?

*Regards
Shashank *
CSE,BIT Mesra

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/XyZJK5SjreIJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] logic???????????

2011-08-13 Thread sagar pareek
kk

On Sat, Aug 13, 2011 at 9:26 PM, WgpShashank shashank7andr...@gmail.comwrote:

 @Sagar Dude , oh common shashank...its not that easy u told. I Hope
 You Understand the question properly ? or you are talking about *bitonic
 sequence*  if not then  just point the obvious or no-obvious bug in above
 algorithm, Same Algo is coded below by Yasir, also Kunal Also suggested some
 improvement to reduce the number instruction , i don't think anything wrong
 in the algorithm ??

 Just Check The Code ,Still  if anything wrong do notify me , i will
 seriously look at that again ?

 *Regards
 Shashank *
 CSE,BIT Mesra

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/XyZJK5SjreIJ.

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] logic???????????

2011-08-13 Thread sagar pareek
First of all
how will u know the pivot points if u don't know original array
secondly
if u know pivot points and suppose u want to find 12 in ur above example
then how will u first of all find 2 as u dont know the shift number
On Sun, Aug 14, 2011 at 1:36 AM, sagar pareek sagarpar...@gmail.com wrote:

 kk


 On Sat, Aug 13, 2011 at 9:26 PM, WgpShashank 
 shashank7andr...@gmail.comwrote:

 @Sagar Dude , oh common shashank...its not that easy u told. I Hope
 You Understand the question properly ? or you are talking about *bitonic
 sequence*  if not then  just point the obvious or no-obvious bug in
 above algorithm, Same Algo is coded below by Yasir, also Kunal Also
 suggested some improvement to reduce the number instruction , i don't think
 anything wrong in the algorithm ??

 Just Check The Code ,Still  if anything wrong do notify me , i will
 seriously look at that again ?

 *Regards
 Shashank *
 CSE,BIT Mesra

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/XyZJK5SjreIJ.

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD




-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] logic???????????

2011-08-13 Thread Yasir
@Sagar
..an array which is sorted but rotated by some k places which is nt kwn
Kindly note that:  ARRAY IS KNOWN,  k is NOT known.

If the array is not known then where will you search an item???   :P  :P

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/TfoI2uYkGCAJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] logic???????????

2011-08-13 Thread sagar pareek
arey mean original array.
array without rotation :D
and if u know the pivot point then how u will came to know its position in
rotated array...
like in above example
we have to search 12
then how will u know abt position of 2?

On Sun, Aug 14, 2011 at 6:15 AM, Yasir yasir@gmail.com wrote:

 @Sagar
 ..an array which is sorted but rotated by some k places which is nt kwn
 Kindly note that:  ARRAY IS KNOWN,  k is NOT known.

 If the array is not known then where will you search an item???   :P  :P

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/TfoI2uYkGCAJ.

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] logic???????????

2011-08-13 Thread Gaurav Menghani
After finding the pivot, can't we just use the normal binary search,
just change the array notation to use modular arithmetic.

i.e, instead of arr[i], use arr[(i+k)%n], where n is the number of
elements in the array. Rest of the code remains same.

On Sun, Aug 14, 2011 at 10:41 AM, sagar pareek sagarpar...@gmail.com wrote:
 arey mean original array.
 array without rotation :D
 and if u know the pivot point then how u will came to know its position in
 rotated array...
 like in above example
 we have to search 12
 then how will u know abt position of 2?

 On Sun, Aug 14, 2011 at 6:15 AM, Yasir yasir@gmail.com wrote:

 @Sagar
 ..an array which is sorted but rotated by some k places which is nt kwn
 Kindly note that:  ARRAY IS KNOWN,  k is NOT known.

 If the array is not known then where will you search an item???   :P  :P

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/TfoI2uYkGCAJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



 --
 Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Gaurav Menghani

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] logic???????????

2011-08-12 Thread Amol Sharma
i doubt if it is possible in O(logn).

i think you can first 'k' in one traversal and then make the array as it was
before in O(n) and then apply binary search.so its basically a O(n)
solution...

if anyone has better ideas then please share !!.
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Fri, Aug 12, 2011 at 3:17 PM, jagrati verma
jagrativermamn...@gmail.comwrote:

 to implement a binary search in an array which is sorted but roated by
 some k places which is nt kwn  time complexity O(logn)

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] logic???????????

2011-08-12 Thread WgpShashank
Hi Guys Here is the algorithm for doing same in O(logn) 

Hint :  Find the pivot point, divide the array in two sub-arrays and call 
binary search. Thats It :)

Algorithm
1. A Pivot Point is point around which array is rotated so 1st we need to 
find out its location/index. lets say it pivot.
  a. to find pivot point we use same idea of binary search   check if  
arr[mid]a[mid+1] if true then return pivot=mid.
  b  else if arr[low]a[mid] search for pivot in left 
  c. else search for pivot in right half of array.
 Time Complexity O(logn)

2.  Once we have found index of pivot point check if desired element is same 
value at pivot index or not e.g.
a. ( if a[pivot]==value we are searching for ) the simply return true or 
1 .  
  Now call binary search for one of the two sub-arrays. 
 (ab) *If *element is greater than 0th element then  search in left 
array  
 (ac) *Else* Search in right array  *
 (ad) If *element is found in selected sub-array then return index  
*Else *return -1.

 Again Time Complexity O(logn)

Hope You Can Make it in Running Code , Do Noify me if You Need More 
Explanation or if missed Something?? 

*Regards
Shashank Mani Computer Science Is Awesome So Why I Write Code
Computer Science
Birla institute of Technology Mesra
*



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/QPCzNLNf_sEJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] logic???????????

2011-08-12 Thread sagar pareek
oh common shashank...its not that easy u told.
just do codingthen u will find the error in ur logic

On Fri, Aug 12, 2011 at 6:25 PM, WgpShashank shashank7andr...@gmail.comwrote:

 Hi Guys Here is the algorithm for doing same in O(logn)

 Hint :  Find the pivot point, divide the array in two sub-arrays and call
 binary search. Thats It :)

 Algorithm
 1. A Pivot Point is point around which array is rotated so 1st we need to
 find out its location/index. lets say it pivot.
   a. to find pivot point we use same idea of binary search   check if
 arr[mid]a[mid+1] if true then return pivot=mid.
   b  else if arr[low]a[mid] search for pivot in left
   c. else search for pivot in right half of array.
  Time Complexity O(logn)

 2.  Once we have found index of pivot point check if desired element is
 same value at pivot index or not e.g.
 a. ( if a[pivot]==value we are searching for ) the simply return true
 or 1 .
   Now call binary search for one of the two sub-arrays.
  (ab) *If *element is greater than 0th element then  search in
 left array
  (ac) *Else* Search in right array  *
  (ad) If *element is found in selected sub-array then return
 index
 *Else *return -1.

  Again Time Complexity O(logn)

 Hope You Can Make it in Running Code , Do Noify me if You Need More
 Explanation or if missed Something??

 *Regards
 Shashank Mani Computer Science Is Awesome So Why I Write Code
 Computer Science
 Birla institute of Technology Mesra
 *



  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/QPCzNLNf_sEJ.

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] logic error:

2011-06-09 Thread sunny agrawal
check  your this if condition
if(tmap.end()-second=4)
{
ans=tmap.end()-first;
}

it should be == , not =

On Thu, Jun 9, 2011 at 5:09 PM, John Hayes agressiveha...@gmail.com wrote:

 Hello every one  i tried to code the same problem using STL mapsbut
 getting the RUN TIME ERROR
 plz help in correcting my code

 #includeiostream
 #includemap
 #includestring
 #includecstdio
 #includealgorithm
 using namespace std;
 int main()
 {
 int tc,i,t1,t2;
 string s1,s2,ans;
 mapstring,int tmap;
 scanf(%d,tc);
 while(tc--)
 {
 for(i=0;i16;i++)
 {
 cins1;
 cins2;
 cint1t2;
 if(t1t2)
 tmap[s1]+=1;
 else
 tmap[s2]+=1;
 }
 //couttmap[ger];
 mapstring,int::iterator it;
 for(it=tmap.begin();it!=tmap.end();++it)
 {
 if(it-second==4)
 break;

 }
 if(it!=tmap.end())
 {
 ans=it-first;
 }

 if(tmap.end()-second=4)
 {
 ans=tmap.end()-first;
 }
 coutansendl;
 tmap.erase(tmap.begin(),tmap.end());
 }
 return 0;
 }




 On Mon, Jun 6, 2011 at 11:23 AM, PRAMENDRA RATHi rathi 
 prathi...@gmail.com wrote:

 tnx all of u...what a foolish mistake i hd done:P


 On Mon, Jun 6, 2011 at 10:38 PM, saurabh singh saurab...@gmail.comwrote:

 Agree with logic king...Moreover have you thouht of using maps?That will
 improove your code's efficiency(With respect to current code) and also make
 it shorter,

 On Mon, Jun 6, 2011 at 5:12 PM, Logic King 
 crazy.logic.k...@gmail.comwrote:

 How can you assume that team name cannot be other than these.where
 in the question is written that only these teams will constitute the last
 16.

 i hope you got my point and your mistake as well !!

   On Mon, Jun 6, 2011 at 4:28 AM, PRAMENDRA RATHi rathi 
 prathi...@gmail.com wrote:


 no, i am getting wrong answer again with this logic..

 it is my code::

 int main()
 {
 register int test,i,j,winner=0,g1,g2;
 string s1,s2;
 string
 team[16]={ARG,BEL,BRZ,CAM,COL,CRC,CZE,ENG,GER,IRE,ITA,NET,ROM,SPA,URU,YUG};

 cin test;
 while(test--)
 {
 int point[16]={0};
 for(j=0;j16;j++)
 {
 cins1s2g1g2;
 if(g1g2)
 {
 for(i=0;i16;i++)
 {
 if(s1==team[i])
 {point[i]++;break;}
 }
 }
 else
 {
 for(i=0;i16;i++)
 {
 if(s2==team[i])
 {point[i]++;break;}
 }
 }

 }
 int big=0;
 for(i=0;i16;i++)

 { coutteam team[i]::point[i]endl;
 if(point[i]==4){coutteam[i]endl;break;}}

 }

 return 0;

 }


 On Mon, Jun 6, 2011 at 1:49 PM, nicks crazy.logic.k...@gmail.comwrote:

 @parmendra..yeah u r right what's ur problem u r not able to implement
 it r whatonly winner will win 4 matches runner and 3rd posn will win 
 3
 match each...


 On Mon, Jun 6, 2011 at 12:47 AM, arun kumar kumar0...@gmail.comwrote:

 any team which has nt lost a match will win

 On Mon, Jun 6, 2011 at 1:12 PM, PRAMENDRA RATHi rathi
 prathi...@gmail.com wrote:
  i am thinking that the team with win point 4 will be the winner ..
  is this wrong?
 
  https://www.spoj.pl/problems/SBETS/
 
 
  because there are only 16 match 8+4+2+1(final) +1(for  runner up)
  so any team can play at max 4 match.
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
  You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
  You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
  You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Saurabh Singh
 B.Tech (Computer 

Re: [algogeeks] logic error:

2011-06-06 Thread arun kumar
any team which has nt lost a match will win

On Mon, Jun 6, 2011 at 1:12 PM, PRAMENDRA RATHi rathi
prathi...@gmail.com wrote:
 i am thinking that the team with win point 4 will be the winner ..
 is this wrong?

 https://www.spoj.pl/problems/SBETS/


 because there are only 16 match 8+4+2+1(final) +1(for  runner up)
 so any team can play at max 4 match.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] logic error:

2011-06-06 Thread nicks
@parmendra..yeah u r right what's ur problem u r not able to implement it r
whatonly winner will win 4 matches runner and 3rd posn will win 3 match
each...

On Mon, Jun 6, 2011 at 12:47 AM, arun kumar kumar0...@gmail.com wrote:

 any team which has nt lost a match will win

 On Mon, Jun 6, 2011 at 1:12 PM, PRAMENDRA RATHi rathi
 prathi...@gmail.com wrote:
  i am thinking that the team with win point 4 will be the winner ..
  is this wrong?
 
  https://www.spoj.pl/problems/SBETS/
 
 
  because there are only 16 match 8+4+2+1(final) +1(for  runner up)
  so any team can play at max 4 match.
 
  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] logic error:

2011-06-06 Thread PRAMENDRA RATHi rathi
no, i am getting wrong answer again with this logic..

it is my code::

int main()
{
register int test,i,j,winner=0,g1,g2;
string s1,s2;
string
team[16]={ARG,BEL,BRZ,CAM,COL,CRC,CZE,ENG,GER,IRE,ITA,NET,ROM,SPA,URU,YUG};

cin test;
while(test--)
{
int point[16]={0};
for(j=0;j16;j++)
{
cins1s2g1g2;
if(g1g2)
{
for(i=0;i16;i++)
{
if(s1==team[i])
{point[i]++;break;}
}
}
else
{
for(i=0;i16;i++)
{
if(s2==team[i])
{point[i]++;break;}
}
}

}
int big=0;
for(i=0;i16;i++)

{ coutteam team[i]::point[i]endl;
if(point[i]==4){coutteam[i]endl;break;}}

}

return 0;
}


On Mon, Jun 6, 2011 at 1:49 PM, nicks crazy.logic.k...@gmail.com wrote:

 @parmendra..yeah u r right what's ur problem u r not able to implement it r
 whatonly winner will win 4 matches runner and 3rd posn will win 3 match
 each...


 On Mon, Jun 6, 2011 at 12:47 AM, arun kumar kumar0...@gmail.com wrote:

 any team which has nt lost a match will win

 On Mon, Jun 6, 2011 at 1:12 PM, PRAMENDRA RATHi rathi
 prathi...@gmail.com wrote:
  i am thinking that the team with win point 4 will be the winner ..
  is this wrong?
 
  https://www.spoj.pl/problems/SBETS/
 
 
  because there are only 16 match 8+4+2+1(final) +1(for  runner up)
  so any team can play at max 4 match.
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] logic error:

2011-06-06 Thread Logic King
How can you assume that team name cannot be other than these.where in
the question is written that only these teams will constitute the last 16.

i hope you got my point and your mistake as well !!

On Mon, Jun 6, 2011 at 4:28 AM, PRAMENDRA RATHi rathi
prathi...@gmail.comwrote:


 no, i am getting wrong answer again with this logic..

 it is my code::

 int main()
 {
 register int test,i,j,winner=0,g1,g2;
 string s1,s2;
 string
 team[16]={ARG,BEL,BRZ,CAM,COL,CRC,CZE,ENG,GER,IRE,ITA,NET,ROM,SPA,URU,YUG};

 cin test;
 while(test--)
 {
 int point[16]={0};
 for(j=0;j16;j++)
 {
 cins1s2g1g2;
 if(g1g2)
 {
 for(i=0;i16;i++)
 {
 if(s1==team[i])
 {point[i]++;break;}
 }
 }
 else
 {
 for(i=0;i16;i++)
 {
 if(s2==team[i])
 {point[i]++;break;}
 }
 }

 }
 int big=0;
 for(i=0;i16;i++)

 { coutteam team[i]::point[i]endl;
 if(point[i]==4){coutteam[i]endl;break;}}

 }

 return 0;

 }


 On Mon, Jun 6, 2011 at 1:49 PM, nicks crazy.logic.k...@gmail.com wrote:

 @parmendra..yeah u r right what's ur problem u r not able to implement it
 r whatonly winner will win 4 matches runner and 3rd posn will win 3
 match each...


 On Mon, Jun 6, 2011 at 12:47 AM, arun kumar kumar0...@gmail.com wrote:

 any team which has nt lost a match will win

 On Mon, Jun 6, 2011 at 1:12 PM, PRAMENDRA RATHi rathi
 prathi...@gmail.com wrote:
  i am thinking that the team with win point 4 will be the winner ..
  is this wrong?
 
  https://www.spoj.pl/problems/SBETS/
 
 
  because there are only 16 match 8+4+2+1(final) +1(for  runner up)
  so any team can play at max 4 match.
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
  You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
  You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] logic error:

2011-06-06 Thread saurabh singh
Agree with logic king...Moreover have you thouht of using maps?That will
improove your code's efficiency(With respect to current code) and also make
it shorter,
On Mon, Jun 6, 2011 at 5:12 PM, Logic King crazy.logic.k...@gmail.comwrote:

 How can you assume that team name cannot be other than these.where in
 the question is written that only these teams will constitute the last 16.

 i hope you got my point and your mistake as well !!

 On Mon, Jun 6, 2011 at 4:28 AM, PRAMENDRA RATHi rathi prathi...@gmail.com
  wrote:


 no, i am getting wrong answer again with this logic..

 it is my code::

 int main()
 {
 register int test,i,j,winner=0,g1,g2;
 string s1,s2;
 string
 team[16]={ARG,BEL,BRZ,CAM,COL,CRC,CZE,ENG,GER,IRE,ITA,NET,ROM,SPA,URU,YUG};

 cin test;
 while(test--)
 {
 int point[16]={0};
 for(j=0;j16;j++)
 {
 cins1s2g1g2;
 if(g1g2)
 {
 for(i=0;i16;i++)
 {
 if(s1==team[i])
 {point[i]++;break;}
 }
 }
 else
 {
 for(i=0;i16;i++)
 {
 if(s2==team[i])
 {point[i]++;break;}
 }
 }

 }
 int big=0;
 for(i=0;i16;i++)

 { coutteam team[i]::point[i]endl;
 if(point[i]==4){coutteam[i]endl;break;}}

 }

 return 0;

 }


 On Mon, Jun 6, 2011 at 1:49 PM, nicks crazy.logic.k...@gmail.com wrote:

 @parmendra..yeah u r right what's ur problem u r not able to implement it
 r whatonly winner will win 4 matches runner and 3rd posn will win 3
 match each...


 On Mon, Jun 6, 2011 at 12:47 AM, arun kumar kumar0...@gmail.com wrote:

 any team which has nt lost a match will win

 On Mon, Jun 6, 2011 at 1:12 PM, PRAMENDRA RATHi rathi
 prathi...@gmail.com wrote:
  i am thinking that the team with win point 4 will be the winner ..
  is this wrong?
 
  https://www.spoj.pl/problems/SBETS/
 
 
  because there are only 16 match 8+4+2+1(final) +1(for  runner up)
  so any team can play at max 4 match.
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
  You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
  You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Saurabh Singh
B.Tech (Computer Science)
MNNIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] logic error:

2011-06-06 Thread PRAMENDRA RATHi rathi
tnx all of u...what a foolish mistake i hd done:P

On Mon, Jun 6, 2011 at 10:38 PM, saurabh singh saurab...@gmail.com wrote:

 Agree with logic king...Moreover have you thouht of using maps?That will
 improove your code's efficiency(With respect to current code) and also make
 it shorter,

 On Mon, Jun 6, 2011 at 5:12 PM, Logic King crazy.logic.k...@gmail.comwrote:

 How can you assume that team name cannot be other than these.where in
 the question is written that only these teams will constitute the last 16.

 i hope you got my point and your mistake as well !!

 On Mon, Jun 6, 2011 at 4:28 AM, PRAMENDRA RATHi rathi 
 prathi...@gmail.com wrote:


 no, i am getting wrong answer again with this logic..

 it is my code::

 int main()
 {
 register int test,i,j,winner=0,g1,g2;
 string s1,s2;
 string
 team[16]={ARG,BEL,BRZ,CAM,COL,CRC,CZE,ENG,GER,IRE,ITA,NET,ROM,SPA,URU,YUG};

 cin test;
 while(test--)
 {
 int point[16]={0};
 for(j=0;j16;j++)
 {
 cins1s2g1g2;
 if(g1g2)
 {
 for(i=0;i16;i++)
 {
 if(s1==team[i])
 {point[i]++;break;}
 }
 }
 else
 {
 for(i=0;i16;i++)
 {
 if(s2==team[i])
 {point[i]++;break;}
 }
 }

 }
 int big=0;
 for(i=0;i16;i++)

 { coutteam team[i]::point[i]endl;
 if(point[i]==4){coutteam[i]endl;break;}}

 }

 return 0;

 }


 On Mon, Jun 6, 2011 at 1:49 PM, nicks crazy.logic.k...@gmail.comwrote:

 @parmendra..yeah u r right what's ur problem u r not able to implement
 it r whatonly winner will win 4 matches runner and 3rd posn will win 3
 match each...


 On Mon, Jun 6, 2011 at 12:47 AM, arun kumar kumar0...@gmail.comwrote:

 any team which has nt lost a match will win

 On Mon, Jun 6, 2011 at 1:12 PM, PRAMENDRA RATHi rathi
 prathi...@gmail.com wrote:
  i am thinking that the team with win point 4 will be the winner ..
  is this wrong?
 
  https://www.spoj.pl/problems/SBETS/
 
 
  because there are only 16 match 8+4+2+1(final) +1(for  runner up)
  so any team can play at max 4 match.
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
  You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
  You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT ALLAHABAD


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.