Submission #7472963


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (110)
#define pii pair<int, int>

/////////////////////////////////////////////////////////

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
T1 mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  T1 tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

bool isPrime(int n){
  if(n == 1) return false;
  rep(i, 2, min((int)(pow(n, 0.5) + 1), n)){
    if(n % i == 0) return false;
  }
  return true;
}

/////////////////////////////////////////////////////////

int count(int y, int m, int d){
  if(m < 3){
    y--;
    m += 12;
  }
  int res = 365 * y + y / 4 - y / 100 + y / 400 + 306 * (m + 1) / 10 + d - 429;
  return res;
}

void Main() {
  int N; cin >> N;
  string S; cin >> S;
  vector<int> cnt(4, 0);
  rep(i, 0, N){
    cnt[S[i] - '1']++;
  }
  int ma = 0, mi = INF;
  rep(i, 0, 4){
    chmax(ma, cnt[i]);
    chmin(mi, cnt[i]);
  }
  cout << ma << " " << mi << endl;
}

/////////////////////////////////////////////////////////

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << std::fixed << std::setprecision(15);

  Main();
}

Submission Info

Submission Time
Task A - センター採点
User takeheroaf
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1875 Byte
Status
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Score / Max Score Test Cases
All 100 / 100 00_sample1.txt, 00_sample2.txt, 01_rnd_00.txt, 01_rnd_01.txt, 01_rnd_02.txt, 01_rnd_03.txt, 01_rnd_04.txt, 01_rnd_05.txt, 01_rnd_06.txt, 01_rnd_07.txt, 01_rnd_08.txt, 01_rnd_09.txt, 01_rnd_10.txt, 01_rnd_11.txt, 01_rnd_12.txt, 01_rnd_13.txt, 01_rnd_14.txt, 01_rnd_15.txt, 01_rnd_16.txt, 01_rnd_17.txt, 01_rnd_18.txt, 01_rnd_19.txt, 02_all_1.txt, 02_all_2.txt, 02_all_3.txt, 02_all_4.txt, 03_mini_1.txt, 03_mini_2.txt, 03_mini_3.txt, 03_mini_4.txt
Case Name Status Exec Time Memory
00_sample1.txt 1 ms 256 KB
00_sample2.txt 1 ms 256 KB
01_rnd_00.txt 1 ms 256 KB
01_rnd_01.txt 1 ms 256 KB
01_rnd_02.txt 1 ms 256 KB
01_rnd_03.txt 1 ms 256 KB
01_rnd_04.txt 1 ms 256 KB
01_rnd_05.txt 1 ms 256 KB
01_rnd_06.txt 1 ms 256 KB
01_rnd_07.txt 1 ms 256 KB
01_rnd_08.txt 1 ms 256 KB
01_rnd_09.txt 1 ms 256 KB
01_rnd_10.txt 1 ms 256 KB
01_rnd_11.txt 1 ms 256 KB
01_rnd_12.txt 1 ms 256 KB
01_rnd_13.txt 1 ms 256 KB
01_rnd_14.txt 1 ms 256 KB
01_rnd_15.txt 1 ms 256 KB
01_rnd_16.txt 1 ms 256 KB
01_rnd_17.txt 1 ms 256 KB
01_rnd_18.txt 1 ms 256 KB
01_rnd_19.txt 1 ms 256 KB
02_all_1.txt 1 ms 256 KB
02_all_2.txt 1 ms 256 KB
02_all_3.txt 1 ms 256 KB
02_all_4.txt 1 ms 256 KB
03_mini_1.txt 1 ms 256 KB
03_mini_2.txt 1 ms 256 KB
03_mini_3.txt 1 ms 256 KB
03_mini_4.txt 1 ms 256 KB