oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

changemin Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

changemin.html

Problem Description

This is a more difficult version of "minimum". In this problem, instead of just finding the minimum of an entire array, the array can now change! Between the updates of the array, there will be requests for the minimum value of the current array.

In fact, your program will have to implement the following functions:

  1. void loadArray(int N, int A[]);, which is called at the start of the program that tells you the initial array A of length N.
  2. void update(int P, int V);, which updates the number at position P to value V.
  3. int findMin();, which returns the minimum value within the current array.

To aid you, you have been provided with a special array with extraordinary capabilities, in particular the functions:
  1. void ArrayInsert(int N), which adds an element to the array.
  2. void ArrayRemove(int N), which removes one element with the value N from the array.
  3. int ArraySize(), which returns the number of elements in the array.
  4. int SmallestElement(), which returns the smallest number in the array.

Input

Refer to the "minimum" input description.

Output

Refer to the "minimum" output description.

Limits

Subtask 1 (35%): 1 <= N <= 1 000
Subtask 2 (65%): 1 <= N <= 1 000 000
update() and findMin() will at most be called N times.

Tags

Data Structure, Function Call

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
135501s256MBMinimum
265511s256MBMinimum

Attachments

Attachment Filesize Last Updated
changemin.h206B23 Jul 2013, 07:14:02
grader.cpp584B11 Oct 2015, 14:52:33
ans.cpp151B11 Oct 2015, 15:16:58

Judge Compile Command

g++-8 ans.cpp grader.cpp -o changemin -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.