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

potatomine Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

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

potatomine.html

Problem Description

After getting a tip-off from a myseterious online source, Jiahai the Potato has discovered a dangerous conspiracy against him. He has also discovered a map of a group of land mines laid outside his potato farm. Since the potatoes who conspired against him still need to walk through the minefield, some of the mines are active while some are not.

Jiahai the Potato has grown up, and is now walking out of the minefield into the woods. However, there is a problem. The map showing the mines only indicate an integer label on each of the mine. The mine is active if the integer has no more than two factors. Given the integer on the mine label, help Jiahai the Potato determine if the mine is active.

Your program should implement the following functions:

  1. bool isActive(long long int N), which should return "True" if the mine is active and "False" if the mine is not.

Limits

For all subtasks: isActive() can be called at most 1 000 000 times.
Subtask 1 (18%): 1 <= N <= 1 000 (randomly generated)
Subtask 2 (34%): 1 <= N <= 1 000 000 (randomly generated)
Subtask 3 (47%): 1 <= N <= 1 000 000 000 (randomly generated)
Bonus Subtask 4 (1%): 1 <= N <= 1 000 000 000 (These are generated by Rar the Cat. Good luck.)

Sample Input 1

3
2 5 9

Sample Output 1

1 1 0

Tags

Number Theory, Primes

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
11817.5s32MBMinimum
23427.5s32MBMinimum
34737.5s32MBMinimum
4157.5s32MBMinimum
5017.5s32MBMinimum

Attachments

Attachment Filesize Last Updated
potatomine.h54B4 Dec 2019, 00:01:17
grader.cpp293B4 Dec 2019, 00:01:17
ans.cpp82B4 Dec 2019, 00:01:17

Judge Compile Command

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