Submission #997809

#TimeUsernameProblemLanguageResultExecution timeMemory
997809cpdreamerBliskost (COI23_bliskost)C++17
Compilation error
0 ms0 KiB
void solve(){ int n, q; cin >> n >> q; string a, b; cin >> a >> b; string x = a, y = b; for(int i = 0; i <= q; i++){ if(i){ int p; cin >> p; p--; char c; cin >> c; x[p] = c; a=x; b=y; } for(int i = n-1; i > 0; i--){ if(a[i] <= b[i]){ int d = b[i]-a[i]; a[i] = b[i]; a[i-1] = char( ((a[i-1] -'a'+d)%26) + 'a'); }else{ int d = a[i]-b[i]; b[i] = a[i]; b[i-1] = char( ((b[i-1] -'a'+d)%26) + 'a'); } } cout << (a==b?"da":"ne") << '\n'; } }

Compilation message (stderr)

Main.cpp: In function 'void solve()':
Main.cpp:2:15: error: 'cin' was not declared in this scope
    2 |     int n, q; cin >> n >> q;
      |               ^~~
Main.cpp:3:5: error: 'string' was not declared in this scope
    3 |     string a, b; cin >> a >> b;
      |     ^~~~~~
Main.cpp:3:25: error: 'a' was not declared in this scope
    3 |     string a, b; cin >> a >> b;
      |                         ^
Main.cpp:3:30: error: 'b' was not declared in this scope
    3 |     string a, b; cin >> a >> b;
      |                              ^
Main.cpp:4:11: error: expected ';' before 'x'
    4 |     string x = a, y = b;
      |           ^~
      |           ;
Main.cpp:10:13: error: 'x' was not declared in this scope
   10 |             x[p] = c;
      |             ^
Main.cpp:12:15: error: 'y' was not declared in this scope
   12 |             b=y;
      |               ^
Main.cpp:25:9: error: 'cout' was not declared in this scope
   25 |         cout << (a==b?"da":"ne") << '\n';
      |         ^~~~