首页 > 其他分享 >CSC3100 Problem Scale & Subtasks

CSC3100 Problem Scale & Subtasks

时间:2024-10-22 18:42:39浏览次数:8  
标签:Scale Subtasks list will CSC3100 A2 time problem your

  1. Requirements

Code (90%)

You can write your code in Java, Python, C, or C++. The time limit may vary among different

languages, depending on the performance of the language. Your code must be a complete excutableprogram instead of only a function. We guarantee test data strictly compliance with the requirementsin the description, and you do not need to deal with cases where the input data is invalid.

No AI Assistance or Plagiarism: All code must be your own. The use of AI tools (e.g., ChatGPT,GitHub Copilot) or copying from external sources or peers is strictly forbidden.Violations of the plagiarism rules will result in 0 points or even failure of this course.

Libraries in this assignment:

  • For C/C++, you can only include standard library.
  • For Java, you can only import java.util.*
  • For Python, you can only import standard library. In other words, you cannot import libraries

such as numpy.We provide an example problem to illustrate the information above better.

Report (10%)

You also need to write a report in pdf type to explain the following:

  • What are the possible solutions for the problem?
  • How do you solve this problem?
  • Why is your solution better than others?

Please note that the maximum number of pages allowed for your report is 5 pages.Remember that the report is to illustrate your thinking process. Keep in mind that your report issupposed to show your ideas and thinking process. We expect clear and precise textual descriptionsin your report, and we do not recommend that you over-format your report.Example Problem: A + B Problem

Description

Given 2 integers A and B, compute and print A + B

Input

Two integers in one line: A, and B

Output

One integer: A + B

Sample Input 1

1 2

Sample Output 1

3

1Problem Scale & Subtasks

For 100% of the test cases, 0 A, B 106

Solutions

Java

import java . util .*;

public class Example {

public static void main ( String [] args ) {

int a , b;

Scanner scanner = new Scanner ( System . in );

a = scanner . nextInt ();

b = scanner . nextInt ();

scanner . close ();

System . out . println (a + b );

}

}

Python

AB = input (). split ()

A , B = int ( AB [0]) , int ( AB [1])

print (A + B )

C

# include < stdio .h >

int main ( int argc , char * argv [])

{

int A , B ;

scanf ("%d%d", &A , &B );

printf ("%d\n", A + B );

return 0;

}

C++

# include < iostream >

int main ( int argc , char * argv [])

{

int A , B ;

std :: cin >> A >> B;

std :: cout < < A + B << std :: endl ;

return 0;

}

  1. Submission

After finishing this assignment, you are required to submit your code to the Online Judge System

(OJ), and upload your .zip package of your code files and report to BlackBoard.

C.1 Online Judge

Once you have completed one problem, you can submit your code on the page on the Online Judgeplatform (oj.cuhk.edu.cn, campus only) to gain marks for the code part. You can submit yoursolution of one problem for no more than 80 times.2After you have submitted your program, OJ will test your program on all test cases and give you agrade. The grade of your latest submission will be regarded as the final grade of the correspondingproblem. Each problem is tested on multiple test cases of different difficulty. You will get a part ofthe score even if your algorithm is not the best.

Note:

The program running time may vary on different machines. 代 写CSC3100 Problem Scale & Subtasks Please refer to the result ofthe online judge system. OJ will show the time and memory limits for different languages on thcorresponding problem page.If you have other questions about the online judge system, please refer to OJ wiki (campus network

only). If this cannot help you, feel free to contact us.

C.2 BlackBoard You are required to upload your source codes and report to the BlackBoard platform. You needto name your files according to the following rules and compress them into A2_<Student ID>.zip :

A2_ < Student ID >. zip

|-- A2_P1_ < Student ID >. java / py /c/ cpp

|-- A2_P2_ < Student ID >. java / py /c/ cpp

|-- A2_Report_ < Student ID >. pdf

For Java users, you don’t need to consider the consistency of class name and file name.

For example, suppose your ID is 123456789, and your problem 1 is written in Python, problem 2 is

written in Java then the following contents should be included in your submitted A2_123456789.zip:

A2_123456789 . zip

|-- A2_P1_123456789 . py

|-- A2_P2_123456789 . java

|-- A2_Report_123456789 . pdf

C.3 Late Submissions

Submissions after Oct. 24 2024 23:59:00(UTC+8) would be considered as LATE.

The LATE submission page will open after deadline on OJ.

Submisson time = max{latest submisson time for every problem, BlackBoard submisson time}

There will be penalties for late submission:

  • 0–24 hours after deadline: final score = your score×0.8
  • 24–72 hours after deadline: final score = your score×0.5
  • 72+ hours after deadline: final score = your score×0

FAQs

Q: My program passes samples on my computer, but not get AC on OJ.

A: Refer to OJ Wiki Q&A

Authors

If you have questions for the problems below, please contact:

3CSC3100 Data Structures Fall 2024

Programming Assignment 2

Zirong Zeng: [email protected]

Chunxu Lin: [email protected]

Due: Oct. 24 2024 23:59:00

Assignment Link: https://oj.cuhk.edu.cn/d/csc3100_2024_fall/homework/6706a6d32579925ba8060510

1 Queue (40% of this assignment)

1.1 Description

Given an n-length list, the value ai in the list satisfies that ai ∈ {1, ..., n} and i = 1, ..., n. Then,numbering each element ai in the list as bi , bi = i.Please find the minimum number of elements that should be deleted so that the list of remainingelements has the same elements as the list of their corresponding numbers.For example, given a list A = {2, 1, 2, 2, 4}, and its number list N = {1, 2, 3, 4, 5}. We need to delete

the 3-rd and 5-th elements from lists A and N because numbers 3 and 5 are not in the list A. Then, thelist A = {2, 1, 2} and its number N = {1, 2, 4}. However, since 4 is not in the list A, we need to delete

the 3-rd element from lists A and N. Finally, we get the list A = {2, 1} and its number list N = {1, 2},where the list A = {2, 1} has the same elements as its number list N = {1, 2}. Conclusively, we delete

3 elements from the list A.

1.2 Input

  • The first line contains a positive integer n.
  • The second line contains the n-length list.

1.3 Output

  • The minimum number of deleted elements.

Sample Input 1

5

2 1 2 2 4

Sample Output 1 3

Sample Input 2

51 3 4 2 5

Sample Output 2

0For a list A = {1, 3, 4, 2, 5}, its number list is N = {1, 2, 3, 4, 5}. We do not need to delete any elementfrom lists A and N since the list A has the same elements as its number list N.

4Sample Input 3 See attached sample . in

Sample Output 3 See attached sample . out

Problem Scale & Subtasks

For 100% of the test cases, 1 n 2 105 .Test Case No. Constraints

Hint

Hint1 : You can use a queue to store elements that are not in a given list but are in its list of numbers.

2 Time Complexity (50% of this assignment)

2.1 Description

John is learning a new programming language called A++. Having just mastered loops, he is excitedly

writing many programs that contain only loop structures. However, he does not know how to computethe time complexity of his programs. So he turns to you for help. What you need to do is to write aprogram to calculate the time complexity for each program that John writes.The loop structure in A++ is as follows:

F i x y... // code block to be executedEHere ”F i x y” indicates creating a variable i initialized as x, then compare i with y, and enter theloop if and only if i is smaller or equal to y. Each time the execution of the code block inside the loopends, i will be changed to i + 1. Then i will be compared with y to determine whether to enter theloop again. The loop ends when i becomes larger than y.Both x and y can be positive integers or the variable n. n represents the size of the data and mustbe retained during time complexity calculations. It cannot be treated as a constant. The value of n is

much greater than 100. x is guaranteed to be smaller or equal to y.”E” indicates the end of the loop. When the loop ends, any variables created within that loop are also

destroyed.

Note: For the sake of convenience in writing, the uppercase letter O is used to represent the standardotion of Θ when describing time complexity in this problem.

2.2 Input

The first line contains a positive integer t, indicating that John writes t (1 t 10) programs in total

(the programs contain only loop structures). Note that the loop structures are allowed to be nested.The following lines describe the t programs in order.For each program, the first line contains a positive integer L (1 L 20000), indicating the numberof lines in this program. The next L lines describe the program in detail: each line is either in the formof ”F i x y” or ”E”, where i is a lowercase letter (it is guaranteed that i will not be letter ”n”), x and5y are either variable n or positive integers smaller than 100, and x is guaranteed to be smaller or equalto y. Since John has mastered loops quite well, there will be no syntax errors in his programs. i.e. F

and E are guaranteed to match each other and he will not use variables that haven’t been destroyedin a loop.

2.3 Output

Output t lines, each indicating the time complexity of a program, in the order of the input. In thisproblem, time complexity is either in the form of O(1) or O(nˆw), where w is a positive integer smallerthan 20000. O(1) means constant time complexity and O(nˆw) means that the time complexity isO(n w)

 

标签:Scale,Subtasks,list,will,CSC3100,A2,time,problem,your
From: https://www.cnblogs.com/goodlunn/p/18493519

相关文章

  • Scaled Dot-Product Attention 的公式中为什么要除以 $\sqrt{d_k}$?
    ScaledDot-ProductAttention的公式中为什么要除以\(\sqrt{d_k}\)?在学习ScaledDot-ProductAttention的过程中,遇到了如下公式\[\mathrm{Attention}(\mathbf{Q},\mathbf{K},\mathbf{V})=\mathrm{softmax}\left(\dfrac{\mathbf{Q}\mathbf{K}}{\sqrt{d_k}}\righ......
  • 【论文阅读】【IEEE TGARS】RRNet: Relational Reasoning Network WithParallel Multi
    引言任务:光学遥感显著目标检测-关系推理论文地址:RRNet:RelationalReasoningNetworkWithParallelMultiscaleAttentionforSalientObjectDetectioninOpticalRemoteSensingImages|IEEEJournals&Magazine|IEEEXplore代码地址:rmcong/RRNet_TGRS2021(g......
  • OmniGenBench: Automating Large-scale in-silico Benchmarking for Genomic Foundati
    本文是LLM系列文章,针对《OmniGenBench:AutomatingLarge-scalein-silicoBenchmarkingforGenomicFoundationModels》的翻译。OmniGenBench:基因组基础模型的大规模计算机基准测试自动化摘要1引言2OmniGenBench3基准结果4相关工作5结论摘要近年来人......
  • Citrix NetscalerStoreFront负载均衡 Load Balancing(精华)
    CitrixNetscalerStoreFront负载均衡LoadBalancing(精华)1.依次展开TrafficManagement/LoadBalancing/Servers,点add添加 在此,我的两台storefront已经全部添加进去4.依次展开TrafficManagement/LoadBalancing/Monitors,点击add添加 6.依次展开TrafficMa......
  • Storefront与NetScaler的集成配置 - part2
    Storefront与NetScaler的集成配置-part2前文介绍了Storefront与NetScaler配置中的StoreFront方面的配置,本章将介绍NetScaler部分的配置。1.从download.citrix.com官方网站下载最新的NetScalerGateway的。对于StoreFront来说,NetSclaer最好使用10.0e和10.1的版本(9.2不支持)。本......
  • 2019-3-13-win10-uwp-使用-ScaleTransform-放大某个元素
    titleauthordateCreateTimecategorieswin10uwp使用ScaleTransform放大某个元素lindexi2019-3-1319:5:56+08002019-03-1316:50:36+0800Win10UWP本文告诉大家如何通过ScaleTransform放大元素放大一个元素的方法有很多个,通过ScaleTransform放大是比较清真的在UWP中Sc......
  • OpenWrt 运行 tailscale 登录 headscale,配置路由转发
    headscale安装参考:https://www.cnblogs.com/nihaorz/p/18455027tailscale安装cd/var/lib/curl-OLhttps://pkgs.tailscale.com/stable/tailscale_1.74.1_arm64.tgztar-zxvftailscale_1.74.1_arm64.tgzmvtailscale_1.74.1_arm64tailscalermtailscale/systemd/tails......
  • docker 容器安装配置 headscale
    docker-compose.ymlservices:headscale:image:headscale/headscale:v0.23.0container_name:headscalevolumes:-/etc/uhttpd.crt:/etc/uhttpd.crt-/etc/uhttpd.key:/etc/uhttpd.key-./etc/headscale/config:/etc/headscale......
  • 《Learning Instance-Level Representation for Large-Scale Multi-Modal Pretraining
    系列论文研读目录文章目录系列论文研读目录摘要1.引言2.相关工作3.方法3.1.模型概述3.2.提取以实例为中心的表示法3.3.多模式预培训目标3.4.转移到下游任务4.实验预训练细节4.2.下游任务评价4.2.1零冲击产品分类4.2.2zero-shot图像-文本检索4.2.3零次产品检索4.2.4零......
  • CSC3100 Data Structures
    RequirementsCode(90%)YoucanwriteyourcodeinJava,Python,C,orC++.Thetimelimitmayvaryamongdifferentanguages,dependingontheperformanceofthelanguage.Yourcodemustbeacompleteexcutableprograminsteadofonlyafunction.Weguara......