Submission #997791

#TimeUsernameProblemLanguageResultExecution timeMemory
997791NakerahBliskost (COI23_bliskost)C++17
28 / 100
101 ms3892 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define PB push_back #define sz(x) (int)x.size() #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define F first #define S second #define PB push_back void setIO(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } void solve(){ int n, q; cin >> n >> q; string a, b; cin >> a >> b; string t = a; for(int i = n-1; i > 0; i--){ while(a[i] != b[i]){ a[i] = char(((a[i]-'a'+1)%26)+'a'); a[i-1] = char(((a[i-1]-'a'+1)%26)+'a'); } } cout << (a==b?"da":"ne") << '\n'; while(q--){ a = t; int p; cin >> p; p--; char c; cin >> c; a[p] = c; for(int i = n-1; i > 0; i--){ while(a[i] != b[i]){ a[i] = char(((a[i]-'a'+1)%26)+'a'); a[i-1] = char(((a[i-1]-'a'+1)%26)+'a'); } } cout << (a==b?"da":"ne") << '\n'; } } int main(){ ios_base::sync_with_stdio(false), cout.tie(NULL), cin.tie(NULL); // setIO(""); int testcase = 1; // cin >> testcase; for(int i = 1; i <= testcase; i++){ // cout << "Case " << i << ": "; solve(); } }

Compilation message (stderr)

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