QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#163819#5422. Perfect PalindromeycrlingWA 41ms3740kbC++14693b2023-09-04 15:31:542023-09-04 15:31:55

Judging History

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

  • [2023-09-04 15:31:55]
  • 评测
  • 测评结果:WA
  • 用时:41ms
  • 内存:3740kb
  • [2023-09-04 15:31:54]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
using namespace std;
const int N = 2e6;
char s[N];
int n;
map <char,int> mp;
void solve() {
  cin >> (s + 1);
  n = strlen(s + 1);
  int ans = n;
  for (int i = 1; i <= n; i++)  mp[s[i]] ++;
  for (int i = 1; i <= n; i++)  ans = min(ans, n - mp[s[i]]);
  cout << ans << "\n";
}
signed main () {
  ios :: sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  int T = 1;
  cin >> T;
  while (T--)  solve();
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3636kb

input:

2
abcb
xxx

output:

2
0

result:

ok 2 number(s): "2 0"

Test #2:

score: -100
Wrong Answer
time: 41ms
memory: 3740kb

input:

11107
lfpbavjsm
pdtlkfwn
fmb
hptdswsoul
bhyjhp
pscfliuqn
nej
nxolzbd
z
clzb
zqomviosz
u
ek
vco
oymonrq
rjd
ktsqti
mdcvserv
x
birnpfu
gsgk
ftchwlm
bzqgar
ovj
nsgiegk
dbolme
nvr
rpsc
fprodu
eqtidwto
j
qty
o
jknssmabwl
qjfv
wrd
aa
ejsf
i
npmmhkef
dzvyon
p
zww
dp
ru
qmwm
sc
wnnjyoepxo
hc
opvfepiko
inuxx...

output:

8
6
0
7
2
4
0
2
-1
-2
4
-2
0
-2
0
-1
0
1
-1
1
-4
0
-1
-5
-2
-3
-5
-6
-4
-3
-5
-5
-11
-2
-4
-6
-3
-9
-6
-2
-7
-9
-5
-9
-8
-8
-12
-5
-6
-8
-7
-8
-6
-12
-11
-9
-9
-8
-6
-11
-6
-11
-12
-15
-11
-12
-11
-10
-11
-13
-7
-14
-12
-9
-7
-14
-11
-12
-18
-14
-15
-20
-13
-15
-17
-21
-13
-22
-19
-18
-16
-17
-12
-1...

result:

wrong answer 2nd numbers differ - expected: '7', found: '6'