# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
580816 | Metal_Sonic | Igra (COCI17_igra) | C++17 | 1 ms | 340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sz(x) (int)(x).size()
#define all(x) x.begin() , x.end()
void setIO(string name = "") {
ios_base::sync_with_stdio(false); cin.tie(nullptr);
if(sz(name)){
freopen((name+".in").c_str(), "r", stdin);
freopen((name+".out").c_str(), "w", stdout);
}
}
void run_test_case(){
int n;cin>>n;
string s , m;cin>>s>>m;
map<char,int>mp;
string ans = "";
for(int i = 0; i < n; i++)mp[s[i]]++;
for(int i = 0; i < n; i++){
if(mp['a'] > 0 && m[i] != 'a'){ans+='a';mp['a']--;continue;}
if(mp['b'] > 0 && m[i] != 'b'){ans+='b';mp['b']--;continue;}
ans+='c';
mp['c']--;
}
cout<<ans;
}
int main() {
setIO();
int T = 1;
while(T--){
run_test_case();
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |