当前位置:网站首页>Memory Limit Exceeded
Memory Limit Exceeded
2022-06-30 17:35:00 【换个名字就很好】
死循环导致
不一定是因为自己显式地创建的变量过多,比如创建过多的列表,字典等等。
可能是死循环,自己写循环没有使得循环出口的关键变量在循环过程中变化,
循环在跑,内存一直增加,导致超出内存限制。
比如下面的求某一个数的因子,初始化因子fac为1,
每次循环,fac理应要自增1,但是忘了写,
就会报错说内存超限,
它没报TLE,所以就很难发觉。
def get_fac(self, target):
if target == 1:
return []
fac = 1
facs = []
while fac*fac <= target:
if target % fac == 0: # in O(N)
facs.append(fac) # list index O(N)
if fac != 1 and fac*fac != target:
facs.append(target//fac)
# fac += 1 # 这里忘了写
return facs
列表导致
可能是列表占内存很大,换成字典后就可以了,这种情况仅适用于可以用字典代替的情况。
边栏推荐
- Vscode status bar statusbar
- SaaS project management system solution for the financial service industry helps enterprises tap a broader growth service space
- 漏洞复现----38、ThinkPHP5 5.0.23 远程代码执行漏洞
- 「杂谈」对数据分析未来的几点思考
- Sign up for Huawei cloud proposition in the "Internet +" competition, and you can take many gifts!
- MRO工业品采购管理系统:赋能MRO企业采购各节点,构建数字化采购新体系
- Apple Watch无法开机怎么办?苹果手表不能开机解决方法!
- Tensorflow2 ten must know for deep learning
- Sword finger offer 17 Print from 1 to maximum n digits
- [cloud resident co creation] Huawei iconnect enables IOT terminals to connect at one touch
猜你喜欢
autocad中文语言锁定只读警报怎么解决?
漏洞复现----37、Apache Unomi 远程代码执行漏洞 (CVE-2020-13942)
屏幕显示技术进化史
Multipass中文文档-设置图形界面
医疗行业企业供应链系统解决方案:实现医疗数智化供应链协同可视
When selecting smart speakers, do you prefer "smart" or "sound quality"? This article gives you the answer
OneFlow源码解析:算子签名的自动推断
Coding officially entered Tencent conference application market!
【TiDB】TiCDC canal_json的实际应用
Sword finger offer 16 Integer power of numeric value
随机推荐
冰河老师的书
OneFlow源码解析:算子签名的自动推断
视频内容生产与消费创新
Merged binary tree of leetcode
挑选智能音箱时,首选“智能”还是“音质”?这篇文章给你答案
Tensorflow2 ten must know for deep learning
使用excel快速生成sql语句
Techo Youth2022学年高校公开课:直播连麦的背后,探索音视频技术如何应用
ONEFLOW source code parsing: automatic inference of operator signature
AI首席架构师10-AICA-蓝翔 《飞桨框架设计与核心技术》
Another CVPR 2022 paper was accused of plagiarism, and Ping An insurance researchers sued IBM Zurich team
TCP粘包问题
Redis - persistent RDB and persistent AOF
Coding officially entered Tencent conference application market!
充值满赠,IM+RTC+X 全通信服务「回馈季」开启
漏洞复现----35、uWSGI PHP 目录遍历漏洞 (CVE-2018-7490)
Tide - 基于 async-std 的 Rust-web 框架
Glacier teacher's book
Four tips tell you how to use SMS to promote business sales?
屏幕显示技术进化史