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

dinner Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

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

dinner.html

Problem Description

Desmond the Moonbear is making dinner for Jiahai and Bradley in order to celebrate the anniversary of the moon landing! To make that occasion even more special, Desmond has created a platter full of their favourite foods, potatoes and peanuts respectively.

However, there's a problem. Jiahai and Bradley are extremely jealous of each other and want to make sure both of them have an equal share of the platter, and Desmond is not being biased against either one of them.

You will be given a grid depicting Desmond's platter:
- 'P' indicates the plate boundary
- '.' indicates an empty spot on the plate
- 'O' indicates a potato on that spot of the platter
- 'N' indicates a peanut on that spot of the platter

Each 'O' and 'N' represents a different potato or peanut. Consecutive 'O's and 'N's do not count as one potato or peanut.

Input

The first line of input will contain H and W, indicating the height and width of the platter.
The next H lines will contain W characters each, describing the platter according to the problem statement.

Output

The output should contain one line with two integers, the number of potatoes and the peanuts respectively. They should be seperated by a single space.
Your output should terminate with a newline.

Limits

1 <= H <= 100
1 <= W <= 100

Sample Input 1

4 4
PPPP
PO.P
PNOP
PPPP

Sample Output 1

2 1

Tags

Syntax

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
1100101s64MBMinimum
2011s64MBMinimum

Judge Compile Command

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