[gcj] Parenting Partnering Returns (WrongAnswer : Test set Skipped )

2020-04-13 Thread Mohammed Usman
I am trying to solve Parenting Partnering Returns in CodeJam 2020 Qualifying round. I am getting the wrong answer response for my code. Can anyone help me know what is wrong? import java.util.*; import java.io.*; public class Solution { public static void main(String[] args) throws IOException{

[gcj] Parenting Partnering Returns Submission error "WA" for code in JAVA

2020-04-08 Thread MANASA
Hi all, For the Parenting Partnering Returns, the code I submitted was not accepted with the remark "WA(Wrong Answer)" . However, I have checked my code against the *Analysis* posted and I have implemented the *Greedy approach* as suggested. Also the output is generated correctly for the sampl

Re: [gcj] Parenting Partnering Returns

2020-04-08 Thread Aditya Balpande
yes I have solved with python #include using namespace std; struct I { int s, e, i; }; bool sortbystarting(I a, I b) { return a.s < b.s; } int main() { cin.sync_with_stdio(false); cin.tie(0); int t, c = 0, i, n; cin >> t; string o; while (c++ < t) { cin >> n

Re: [gcj] Parenting Partnering Returns

2020-04-08 Thread Jonathas Costa
You have to save the original order, then order by start time, distribute the activities and finally re-order using the original order Em qua., 8 de abr. de 2020 às 16:52, Milho Droid escreveu: > Same here. My code is at > https://github.com/luizcarlosdev/google_codejam_py, and it passes > norma

Re: [gcj] Parenting Partnering Returns

2020-04-08 Thread Milho Droid
Same here. My code is at https://github.com/luizcarlosdev/google_codejam_py, and it passes normally with the given test case, but it fails with WA in Google's test. I gave up trying to know what's wrong, cause I read so much the code and haven't found a reason... Created many other tests and go

[gcj] Parenting Partnering Returns - sort by end time

2020-04-07 Thread Quoc Khanh Thai
Hi all, As we have seen the solution for this problem is to greedily assign the task after sorting the *start time *of the activities. But I was thinking sorting by the *end time *should also bring the correct result. Nevertheless, I got WA for this approach. My code is as below import java.ut

Re: [gcj] Parenting Partnering Returns Question

2020-04-07 Thread 'Pablo Heiber' via Google Code Jam
Hi, There was a typo in the analysis. That > should have been a <. This was fixed on Monday. Best, Pablo On Mon, Apr 6, 2020 at 6:02 PM Dhruva Sagar wrote: > The analysis is out, and I am quoting this from the analysis : > > An activity with start time s1 and end time t1 overlaps with another

[gcj] Parenting Partnering

2020-04-07 Thread divyansh srivastava
I think your solution is O(n^2). Could you also share what ur code is doing here. -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-code+unsubscr...@goo

Re: [gcj] Parenting Partnering Returns

2020-04-07 Thread Samarth Pardhi
Hi, It's working fine with all kind of test cases in my console, but showed WA error in code jam. Can you please comment on my approach: t=int(input())for i in range(t): n=int(input()) clist=[] jlist=[] ans='' for j in range(n): tempsl=list(map(int,input().strip().split

Re: [gcj] Parenting Partnering Returns

2020-04-07 Thread Samuel Jawahar
Hello Sir can you please review my Code? import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Solution { private static boolean isOverLapping(ArrayList activityList, Acti

[gcj] Parenting Partnering question sample set wrong?

2020-04-07 Thread Aditya Gupta
Hi, In this question, the sample case #3, the answer is wrong according to me. The 3rd sample case consists of 5 jobs: 99 150 1 100 100 301 2 5 150 250 Chronologically, it is in this order: 1 100 2 5 99 150 100 301 150 250 So if we assume J picks up the 1st task, it comes out to be JCCJC and n

[gcj] Parenting Partnering Returns more creative solution?

2020-04-07 Thread Igor Cha
Hi, so for this problem, my initial thought was to do it exactly as stated in the solution for it, but I thought I came up with a more creative/better way to do it by creating pseudo calendars using an array. For some reason I was getting WA the whole time and because I started super late, I

Re: [gcj] Parenting Partnering Returns

2020-04-07 Thread Nagesh Reddy
Check the following simple code for Parenting Partner : *def solve():n = int(raw_input()); a = []for i in range(n): s,e = map(int,raw_input().split())a.append([s,e,i])a.sort(); sch = [0]*n; x = -1; y = -1for i in range(n):if a[i][0] wrote: > I

[gcj] Parenting Partnering Returns

2020-04-07 Thread Quoc Khanh Thai
Hi all, As we have seen the solution for this problem is to greedily assign the task after sorting the *start time *of the activities. But I was thinking sorting by the *end time *should also bring the correct result. Nevertheless, I got WA for this approach. My code is as below import java.ut

Re: [gcj] Parenting Partnering Returns

2020-04-06 Thread Denys Halachian
I hope its help, from functools import reduce class Solver(object): def __init__(self): super().__init__() def find_distribution(self, intervals): _intervals = list(intervals) intervals.sort(key=lambda x: x[0]) mp = {} J = 0 C = 0

[gcj] Parenting Partnering Returns from qualification round 2020

2020-04-06 Thread Kirill Lykov
I had the following idea: 1) Sort intervals in the lexicographical order 2) Mark all intervals as J 3) Mark 0th interval as C, call it prev 4) For all intervals 5) if prev interval marked as C is not intersecting the current interval, mark current interval as C, update prev 6) Check that t

[gcj] Parenting Partnering

2020-04-06 Thread Thusitha Thilina Dayaratne
Hi All, This is the solution that I come up with for the Parenting Partnering task. no_of_tests = int(input()) for i in range(no_of_tests): schedule = '' c_busy = [0] * 1441 j_busy = [0] * 1441 n_tasks = int(input()) tasks = [] for count in range(n_tasks): tasks.a

[gcj] Parenting Partnering WA, please help

2020-04-06 Thread Aditya Vikram Jain
I'm not able to make out why my code below fails. Any help would be most welcome #include #include #include #include #include using namespace std; int main(){ int T; cin>>T; for(int tc = 1;tc<=T;tc++){ int N; cin >> N; vector,int > > vData; pair

[gcj] Parenting Partnering Returns: WA

2020-04-06 Thread Rohit Sutradhar
Hi I am getting a wrong answer verdict but I don't know why. I read the analysis and my code, as far as I understood, uses the same logic. Here's my code: #include "bits/stdc++.h" using namespace std; vector ind; int search(vector> v, int l, int r, int key) { for(int i=l;i<=r;i++) { i

[gcj] Parenting Partnering Returns - Solution in C++

2020-04-06 Thread Elyasin Shaladi
I would like to ask for some help for the recent Code Jam problem Parenting Partnering Returns. I wrote my solution in C++11. My solution returns Sample Failed: WA - though I cannot figure out an example test case that makes my code fail. My solution is close to what was described in the analys

[gcj] Parenting Partnering Returns Question

2020-04-06 Thread Dhruva Sagar
The analysis is out, and I am quoting this from the analysis : An activity with start time s1 and end time t1 overlaps with another > activity with start time s2 and end time t2 if the time intersection is > not empty (i.e., max(s1, s2) > min(t1, t2)). > The same provided in the problem has th

Re: [gcj] Parenting Partnering return

2020-04-06 Thread Joseph DeVincentis
If there are three tasks that conflict in the same period of time, then it is impossible, yes. But consider this input: 1 4 0 100 400 500 0 300 200 600 A working allocation is to put tasks 1 and 4 on one parent and 2 and 3 on the other. But by processing them in the original order and always assig

[gcj] Parenting Partnering - WA

2020-04-06 Thread Gopala Krishna Viroti
I am getting WA but the code is working fine for sample test cases. Below is my code can some hep - what is wrong with my code ? import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.

[gcj] Parenting Partnering Returns

2020-04-06 Thread Boopesh Shanmugam
What seems to be wrong in this code , its passing the visible test cases but am getting wrong answer when i subimit n=int(input()) for m in range(n): no=int(input()) inp=[] res=[] flag=1 tempo={} for j in range(no): temp=list(map(int,input().split())) inp.a

[gcj] Parenting Partnering Returns

2020-04-06 Thread Martin Seeler
I'm asking to keep my sanity: Did anyone solve this problem with Python? I can't find these tricky edge cases where my code fails, all variations I try on my machine seem to work just fine. Still CodeJam Environment says *WA*. If there is someone who solved it in python, then I know I'm missing

[gcj] Parenting Partnering return

2020-04-06 Thread Atta Mohamed
- why I got the wrong answer with this code? - do we need sorting? - I assumed that if three activities overlap with each other so the there is no solution is this assumption correct? import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.H

Re: [gcj] Parenting Partnering: Analysis

2017-05-02 Thread Leandro Coutinho
Thanks a lot Paul and Abhishek! =) On Tue, May 2, 2017 at 2:28 AM, Abhishek Nanda wrote: > C (0-720) and J(720-1440) is two exchanges, one at time 0 and another at > time 720. The exchange at time 0 is the same as the exchange at time 1440 > depending on which day you count midnight. > > What yo

Re: [gcj] Parenting Partnering: Analysis

2017-05-02 Thread Abhishek Nanda
C (0-720) and J(720-1440) is two exchanges, one at time 0 and another at time 720. The exchange at time 0 is the same as the exchange at time 1440 depending on which day you count midnight. What you've listed is sample 4, and the answer is indeed 4 for it. Sample 3's input is: 1 1 1439 1440 0 1

Re: [gcj] Parenting Partnering: Analysis

2017-05-02 Thread Paul Smith
In sample case 3, J must have the baby for 0 to 1, and C must have the baby from 1439 to 1440. I think you've misread the input perhaps? On Tue, 2 May 2017 at 09:16 Paul Smith wrote: > You do this pattern every day, so if C has the baby from 0 to 719, and > hands over to J for 720-1439, J has t

Re: [gcj] Parenting Partnering: Analysis

2017-05-02 Thread Paul Smith
You do this pattern every day, so if C has the baby from 0 to 719, and hands over to J for 720-1439, J has to hand back to C to start the next day. If you think about it, the number of exchanges must always be even, otherwise the next day starts with a different parent. On Tue, 2 May 2017 at 00:0

[gcj] Parenting Partnering: Analysis

2017-05-01 Thread newbie007
is 0 midnight? is 1440 midnight? why if C (0-720) and J(720-1440) is not only ONE exchange? I didn't understand sample case 3: 2 2 0 1 1439 1440 1438 1439 1 2 time taking care of the baby: James..: 0-1, 720-1438, 1439-1440 Cameron: 1-720, 1438-1439 I counted 4