/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 328.0 KiB
#2 Wrong Answer 6ms 756.0 KiB
#3 Wrong Answer 2ms 540.0 KiB

Code

#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main()
{
    int t, n;
	cin >> t;
	while (t-- && cin >> n)
	{
		string s;
		cin >> s;
		string p = s;
		sort(p.begin(), p.end());
		reverse(p.begin(), p.end());
		int ans = 0;
		for (int i = 0; i < s.size(); i++)
		{
			ans += (s[i] != p[i]);
		}
		ans /= 2;
		cout << ans << "\n";
	}
}

Information

Submit By
Type
Submission
Problem
P1016 Swap sort
Language
C++17 (G++ 13.2.0)
Submit At
2023-12-28 14:26:02
Judged At
2024-11-11 03:47:04
Judged By
Score
20
Total Time
6ms
Peak Memory
756.0 KiB