QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#745742#9741. CCPCxydCatGirl#AC ✓2ms4580kbC++201.7kb2024-11-14 11:19:312024-11-14 13:51:35

Judging History

你现在查看的是最新测评结果

  • [2024-11-14 13:51:35]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:AC
  • 用时:2ms
  • 内存:4580kb
  • [2024-11-14 13:51:34]
  • hack成功,自动添加数据
  • (/hack/1179)
  • [2024-11-14 11:19:33]
  • 评测
  • 测评结果:100
  • 用时:2ms
  • 内存:4536kb
  • [2024-11-14 11:19:31]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define pb emplace_back
#define For(i, x, y) for (int i = (x); i <= (y); i ++)
#define rep(i, x, y) for (int i = (x); i >= (y); i --)
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
#define sz(v) (int)((v).size())
#define ull unsigned long long
#define ls (p << 1)
#define rs (p << 1 | 1)
#define mp make_pair
#define i128 __int128
#define db long double
#define vi vector< int >
#define mem(v, x) memset(v, x, sizeof(v))
#define A3 array< int, 3 >
#define A4 array< int, 4 >
#define vpii vector< pair< int, int > >
using namespace std;
mt19937_64 rnd(time(0));
template< typename T > void cmin(T &x, T y) { return x = min(x, y), void(); }
template< typename T > void cmax(T &x, T y) { return x = max(x, y), void(); }
int ksm(int x, int y, int p) {
    int v = 1; x %= p;
    while (y) v = 1ll * v * ((y & 1) ? x : 1) % p, x = 1ll * x * x % p, y >>= 1;
    return (v % p + p) % p;
}
bool MemoryST;
const int N = 2e5 + 5;
const int mod = 998244353;
const long long INF = 1e18;
const int base = 13131;
void Main() {
	string s; cin >> s;
	int c0 = 0, c1 = 0;
	int n = sz(s);
	For (i, 0, n - 1) {
		if (s[i] == 'C') c0 ++;
		else if (s[i] == 'P') c1 ++;
	}
	cout << max({0ll, min((c0 - 1) / 2, c1)});
    return;
}
bool MemoryED;
signed main() {
    ios :: sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cerr << fixed << setprecision(6) << (&MemoryST - &MemoryED) / 1048576.0 << "MB\n";
    int TESTCNT = 1;
    // cin >> TESTCNT;
    while (TESTCNT --) Main();
    cerr << endl << 1e3 * clock() / CLOCKS_PER_SEC << "ms"; 
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3764kb

input:

ABCDCPCPC

output:

1

result:

ok single line: '1'

Test #2:

score: 0
Accepted
time: 0ms
memory: 4076kb

input:

CAAACPBCDEFGCHIJCKLPM

output:

2

result:

ok single line: '2'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3912kb

input:

CCPPPPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

output:

0

result:

ok single line: '0'

Test #4:

score: 0
Accepted
time: 2ms
memory: 4580kb

input:

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

193517

result:

ok single line: '193517'

Test #5:

score: 0
Accepted
time: 1ms
memory: 4172kb

input:

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

82881

result:

ok single line: '82881'

Test #6:

score: 0
Accepted
time: 1ms
memory: 4100kb

input:

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

60591

result:

ok single line: '60591'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3868kb

input:

C

output:

0

result:

ok single line: '0'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3932kb

input:

P

output:

0

result:

ok single line: '0'

Extra Test:

score: 0
Extra Test Passed