Codeforces Round #389 (Div. 2, Rated, Based on Technocup 2017 – Elimination Round 3), problem: (B) Santa Claus and Keyboard Check Solution in C/C++

By |2017-04-07T22:11:44+00:00January 7th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , |

Codeforces Round #389 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 3), problem: (B) Santa Claus and Keyboard Check Solution in C/C++ #include<stdio.h> typedef unsigned u; char M[128],A[1024],B[1024]; int main() { u i=-1,l=0; for(scanf("%s%s",A,B);A[++i];) { if(M[(u)A[i]]&&M[(u)A[i]]!=B[i]) {printf("-1\n");return 0;} if(M[(u)B[i]]&&M[(u)B[i]]!=A[i]) {printf("-1\n");return 0;} if(!M[(u)A[i]]&&B[i]!=A[i])++l; [...]