codeFlyer (bitFlyer Programming Contest)

Submission #10074747

Source codeソースコード

#include <bits/stdc++.h>

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int a, b, n;
  cin >> a >> b >> n;
  string x;
  cin >> x;
  rep(i, n) {
    if (x[i] == 'S') {
      if (a > 0) a--;
    }
    if (x[i] == 'C') {
      if (b > 0) b--;
    }
    if (x[i] == 'E') {
      if (a > 0 && a >= b)
        a--;
      else if (b > 0 && a < b)
        b--;
    }
  }

  cout << a << endl;
  cout << b << endl;
}

Submission

Task問題 B - 洋菓子店
User nameユーザ名 purple_jwl
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 200
Source lengthソースコード長 1090 Byte
File nameファイル名
Exec time実行時間 4 ms
Memory usageメモリ使用量 512 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample-01.txt,sample-02.txt,sample-03.txt,sample-04.txt
All 200 / 200 01.txt,02.txt,03.txt,04.txt,05.txt,06.txt,07.txt,08.txt,sample-01.txt,sample-02.txt,sample-03.txt,sample-04.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01.txt AC 4 ms 384 KB
02.txt AC 3 ms 384 KB
03.txt AC 3 ms 384 KB
04.txt AC 3 ms 384 KB
05.txt AC 2 ms 256 KB
06.txt AC 4 ms 512 KB
07.txt AC 1 ms 256 KB
08.txt AC 1 ms 256 KB
sample-01.txt AC 1 ms 256 KB
sample-02.txt AC 1 ms 256 KB
sample-03.txt AC 1 ms 256 KB
sample-04.txt AC 1 ms 256 KB