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

shifting Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

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

problem.html

Shifting

Statement

You are given an array of N integers in and array A, you are supposed to do 3 different type of operations:
if the query is 1 i j
Shift the numbers in the array from Ai to Aj inclusive to the front
if the query is 2 i j
Shift the numbers in the array from Ai to Aj inclusive to the back
if the query is 0 i
Output the number at position i, 0-indexed

Input

First line contain 2 integers, N and Q;
Second line contains N integers of the array
Subsequent lines contain T, i, j. T is the query type

Output

If T is 0, output the number at that position, 0-indexed

Scoring

Subtask 1 (5%): N,Q <= 1000
Subtask 2 (15%): N,Q <= 10000
Subtask 3 (69%): N,Q <= 100000
Subtask 4 (11%): N,Q <= 500000
0 <= Ai <= 1000000000 (10^9)
0 <= i <= j < N
T = 0,1,2

Tags

Data Structure

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
15103s512MBMinimum
215103s512MBMinimum
369103s512MBMinimum
41173s512MBMinimum

Judge Compile Command

g++-8 ans.cpp -o shifting -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.