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

spaceinvaders Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

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

statement.html

Problem Description

n Invaders from Outer Space have come to invade your personal space space bar... :O

You must fight them off with the n space ships that you have in your space arsenal

Each ith [1-based] space ship has a power of pi and each invader has a power of ai

Your space ship will beat an alien if its power is >= the power of the alien

Ohnoes,yourspacebarhassufferedseveredamage.canyoustillsavetheday???

Input

The first line of the input consists of 1 integer, n

The second line of the input consists of n space separated integers, ai

The third line of the input consists of n space separated integers, pi

Note: Both lines of the input will be sorted in ascending order

Output

Output in a line n integers between 1 and n of the order in which you place the space ships to match the ith alien

Scoring

Let n be the most aliens defeated possible. If your solution defeats k aliens, you will get a score of (k/n)^2 for that subtask.

Subtasks

Subtask 1 (14%) n<=10

Subtask 2 (32%) n<=1000

Subtask 3 (54%) n<=1000000

Subtask 4 (0%) will be the sample testcases

Sample Testcase 1

Input

3
1 2 3
1 2 3
Output
3 1 2

Explanation + Scoring

This solution will receive 11.1% of the total score.

Spaceship 1 (Power 1) loses to alien 2 (Power 2)

Spaceship 2 (Power 2) loses to alien 3 (Power 3)

Spaceship 3 (Power 3) pwns alien 1 (Power 1)

1/3 of the aliens are destroyed, hence this solution received (1/3)^2=1/9=11.1% of the total score.

Tags

Greedy

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
114102s32MBMinimum
232102s32MBMinimum
354102s32MBMinimum
4012s32MBMinimum

Judge Compile Command

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