#include <bits/stdc++.h>
using namespace std;
int n;
string s1,s2;
int main()
{
cin >>n>>s1>>s2;
for (int i=0;i<n;i++)
{
for (int j=i+1;j<n;j++)
{
if (s1[i]!=s2[j]&&s1[j]!=s2[i])
{
if (s1[i]==s2[i])
swap(s1[i],s1[j]);
else if (s1[i]>s1[j])
swap(s1[i],s1[j]);
}
}
}
if (s1[n-1]==s2[n-1])
{
for (int i=n-1;i>=0;i--)
{
int j=n-1;
if (s1[i]!=s2[j]&&s1[j]!=s2[i])
{
swap(s1[i],s1[j]);
break;
}
}
}
cout <<s1;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
356 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
464 KB |
Output isn't correct |
4 |
Correct |
2 ms |
576 KB |
Output is correct |
5 |
Incorrect |
1 ms |
576 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
616 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
636 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
724 KB |
Output isn't correct |
9 |
Incorrect |
92 ms |
748 KB |
Output isn't correct |
10 |
Incorrect |
94 ms |
780 KB |
Output isn't correct |