QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#333520 | #5577. Alchemy | joelgun14# | WA | 0ms | 3772kb | C++14 | 1.0kb | 2024-02-20 04:46:14 | 2024-02-20 04:46:14 |
Judging History
answer
#include <bits/stdc++.h>
#define fi first
#define se second
#define bit(x) (1LL << (x))
#define getbit(x, i) (((x) >> (i)) & 1)
#define ALL(x) (x.begin(), x.end())
using namespace std;
template <typename T1, typename T2> bool maxi(T1 &a, T2 b) {
if (a < b) {a = b; return true;} return false;
}
template <typename T1, typename T2> bool mini(T1 &a, T2 b) {
if (a > b) {a = b; return true;} return false;
}
const int N = 2e5 + 5;
const int oo = 1e9;
const long long ooo = 1e18;
int main() {
string s;
cin >> s;
if(s.size() == 1) {
cout << 0 << endl;
return 0;
}
bool ans[s.size() / 2];
memset(ans, 0, sizeof(ans));
for(int i = 0; i < s.size() / 2; ++i) {
if(s[i] != s[s.size() - i - 1]) {
ans[i] = 1;
}
}
int res = 0;
for(int i = 1; i < s.size() / 2; ++i) {
if(ans[i - 1]) {
res += 2;
ans[i - 1] = 0, ans[i] = 0;
}
}
if(ans[s.size() / 2 - 1])
++res;
cout << res << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3460kb
input:
ioi
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
noi
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3460kb
input:
ctsc
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
fool
output:
2
result:
ok single line: '2'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
vetted
output:
2
result:
ok single line: '2'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
aa
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3464kb
input:
ic
output:
1
result:
ok single line: '1'
Test #8:
score: -100
Wrong Answer
time: 0ms
memory: 3772kb
input:
tlffohemdcncrfrxaqsbzcoyodvbxmhqukvfpahnakexcmacqa
output:
24
result:
wrong answer 1st lines differ - expected: '12', found: '24'