Submission #10074747
Source Code Expand
#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 Info
Submission Time | |
---|---|
Task | B - 洋菓子店 |
User | purple_jwl |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 1090 Byte |
Status | AC |
Exec Time | 4 ms |
Memory | 512 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt |
All | 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 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
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 |