Submission #580821

#TimeUsernameProblemLanguageResultExecution timeMemory
580821Metal_SonicIgra (COCI17_igra)C++17
40 / 100
1093 ms316 KiB
#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;
    string ans = s;
    sort(all(ans));
    do {
        bool f = true;
        for (int i = 0; i < n; i++)
            if (ans[i] == m[i]) {
                f = false;
                break;
            }
        if (f) {
            cout << ans;
            exit(0);
        }
    }
        while(next_permutation(all(ans)));

}
int main() {
    setIO();
    int T = 1;
    while(T--){
        run_test_case();
    }
    return 0;
}

Compilation message (stderr)

igra.cpp: In function 'void setIO(std::string)':
igra.cpp:9:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |         freopen((name+".in").c_str(), "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
igra.cpp:10:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         freopen((name+".out").c_str(), "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...