Questions tagged [time-limiting]
128 questions
1
vote
1 answer
Setting a limit for running time with a Python 'while' loop
I have some questions related to setting the maximum running time in Python. In fact, I would like to use pdfminer to convert the PDF files to .txt. The problem is that very often, some files are not possible to decode and take an extremely long…

SXC88
- 227
- 1
- 5
- 16
1
vote
2 answers
Number of ways one cannot make a triangle?
Given n and an array of n positive integers, the number of ways one can choose three numbers such that they cannot form a triangle is needed.
Example:
3
4 2 10
Answer:
1
My approach (in JAVA)
int[] arr = new int[n];//list of the numbers…

yobro97
- 1,125
- 8
- 23
1
vote
0 answers
"android.intent.extra.durationLimit" is not working
I have to record a video with time limitation of 10 seconds. I am
trying so many ways but nothing is working fine.
Here is my code:-
Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
//videoUri = Uri.fromFile(mediaFile);
…

Devraj
- 1,479
- 1
- 22
- 42
1
vote
1 answer
MATLAB execution runtime limitation
I want to limit execution runtime of a function I am using in my code. Is it possible?
I am using Windows 10 with MATLAB R2015a (unlike in this question asked before: Matlab time limit for function execution), so has there been any changes to make…

NirZ
- 105
- 1
- 9
1
vote
2 answers
How to optimize dfs traversal on an adjacency list?
//dfs traversal using adjacency list
#include
#include
#define gc getchar_unlocked
#define MOD 1000000007
int visited[100000];
long long int capt=0;
struct node
{
int vertex;
struct node *next;
};
struct node…

gospelslide
- 179
- 2
- 2
- 12
1
vote
2 answers
Time limit exceeded error when using strlen()?
The following code works as expected, this code prints the character that occurs the most number of times in a string:
#include
#include
#include
#include
int main() {
long int i,a[26]={0},m=0 ,c=0 ;
…

imadhsissou
- 585
- 5
- 15
1
vote
1 answer
Loop in python calls a c++ program and shall return to loop after time
I got two for-loops, the inner one calls a c++ program (here replaced by editor emacs), that program have to be terminated after a certain time. Additionally for one concentration each 'acceleration' (1, 2, 3, 4) shall be calculated parallel for…

user3637248
- 11
- 2
1
vote
3 answers
How to use CPLEX timelimit in my code?
I am using C to write my code and solve it with CPLEX optimizer. I want to limit the time on CPLEX so that it stops solving if time is larger than 10 hours.
I have search online and I found the timelimit parameter of CPLEX. However, I do not know…

user2700834
- 11
- 1
- 2
1
vote
2 answers
my solution for (3n+1) is exceeding 3 sec time limit
here i have written a program on (3n+1) problem.it's also a problem from UVa. I believe it's a known problem.but when i am going to submit it in that online judge community it is sending me a Time Exceeding Error. the time limit is 3 sec. I have…

Nasif Imtiaz Ohi
- 1,563
- 5
- 24
- 45
0
votes
1 answer
Merge sort working slower than other sorts when it should'nt be
I wrote a Merge sort code, which works fine in my pc but give "Time Limit Exceeded" error on platforms like leetcode. I have heard that merge sort is faster than Selection, Insertion or Bubble sort, yet, it exceeds time limit while other sorts don't…

temporary singh
- 3
- 2
0
votes
1 answer
F#: how to stop function by time limit
let runWithTimeout (timeout: int) (action: unit -> 'a) : 'a option =
let cts = new CancellationTokenSource(timeout)
try
let task = async { let! res = Task.Run(action, cts.Token)
return res }
…

Andrew
- 23
- 2
0
votes
0 answers
How to retrieve the last best solution in Pulp if it reached a timelimit (with e.g. Gurobi solver)?
Currently if I set a timelimit in Pulp with for example the Gurobi solver, the decision variables of the model have the value corresponding to the last checked solution instead of the last best solution. Does anybody know how to retrieve this last…

Jeroen Bouwman
- 1
- 1
0
votes
0 answers
Time limit on the execution of a mathematical model
I have a mathematical model that takes a long time before returning the solution.
Is it possible to insert a parameter that blocks the execution of the model after a certain time? I would like it to give me a result even if it is not excellent.
I'm…

cocca13
- 1
- 1
0
votes
0 answers
Set time limit to a Dockerhub authentication token
In my script, my goal is to get a list of tags associated with an image from dockerhub. Currently, I do that by getting an authentication token by doing the following
curl -s -H "Content-Type: application/json" -X POST -d "{\"username\":…

Akhilesh Bhatia
- 122
- 1
- 3
- 11
0
votes
1 answer
CPLEX changing the time limit
I am using and running directly from the IBM ILOG CPLEX Optimization Studio to solve an optimization problem. Since the problem and the instance is so big, CPLEX takes a very long time, so I want to limit the runtime to 2 hours. In parameters, the…

Taya Or
- 1