Beispiel #1
0
        static ZTrainingTask CreateZTrainingTask(List <String> taskItems)
        {
            ZTrainingTask task = new ZTrainingTask();

            task.Id = Int64.Parse(taskItems[0]);

            try
            {
                task.Name      = taskItems[1].Substring(1, taskItems[1].Length - 2);
                task.FullName  = taskItems[1];
                task.LinuxName = taskItems[2].Substring(1, taskItems[2].Length - 2);
                if (task.TimeLimit == null)
                {
                    task.Type_id = taskItems[3].Substring(1, taskItems[3].Length - 2);
                }
                else
                {
                    task.Type_id = taskItems[3];
                }
                task.TaskGroup_id = int.Parse(taskItems[4]);
                task.Date         = taskItems[5].Substring(1, taskItems[5].Length - 2);
                task.Year         = int.Parse(taskItems[6]);
                task.Text         = taskItems[7].Substring(1, taskItems[7].Length - 2);


                task.nTests        = int.Parse(taskItems[8]);
                task.TimeLimit     = int.Parse(taskItems[9]);
                task.MemoryLimit   = int.Parse(taskItems[10]);
                task.AuthorId      = Int64.Parse(taskItems[11]);
                task.Author        = taskItems[12].Substring(1, taskItems[12].Length - 2);
                task.isZml         = int.Parse(taskItems[13]);
                task.nSubmissions  = Int64.Parse(taskItems[14]);
                task.nAttempts     = Int64.Parse(taskItems[15]);
                task.nSolved       = Int64.Parse(taskItems[16]);
                task.IsPublic      = int.Parse(taskItems[17]);
                task.WasEverPublic = int.Parse(taskItems[18]);
                task.Source        = taskItems[19].Substring(1, taskItems[19].Length - 2);
                task.SourceUrl     = taskItems[20].Substring(1, taskItems[20].Length - 2);
                task.HasGrader     = int.Parse(taskItems[21]);
                task.UploadedTests = int.Parse(taskItems[22]);
                task.Stars         = double.Parse(taskItems[23]);
                task.Locked        = int.Parse(taskItems[24]);
                task.Category      = int.Parse(taskItems[25]);
                task.SubCategory   = int.Parse(taskItems[25]);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            if (task.Id < 50000)
            {
                task.Text = task.LinuxName;
            }


            return(task);
        }
Beispiel #2
0
        static public PetljaTask ToPetlja(ZTrainingTask ztTask)
        {
            PetljaTask pt = new PetljaTask();

            pt.Id        = ztTask.Id;
            pt.RefId     = ztTask.FullName;
            pt.Title     = ztTask.Name;
            pt.TimeLimit = ((double)ztTask.TimeLimit) / 1000;      //miliS to S
            pt.MemLimit  = ((double)ztTask.MemoryLimit) / 1048576; //B to MB
            //pt.Owner =
            pt.Origin = "Z Trening " + ztTask.Source + " URL:" + ztTask.SourceUrl;
            //pt.Tags =
            //pt.Solutions =
            pt.Status   = "KANDIDAT";
            pt.StatusOd = "Year:" + ztTask.Year;

            pt.Lang = ztTask.Type_id;
            pt.Text = ToMdTextFormat(ztTask.Text);

            return(pt);
        }