Submission #619888

#TimeUsernameProblemLanguageResultExecution timeMemory
619888gonzakia29Crossing (JOI21_crossing)C++17
26 / 100
7006 ms2820 KiB
#include <iostream> using namespace std; string s1,s2,s3,s4,s5,s6,s7,s8,s9; int main(){ int n; cin >> n; cin >> s1 >> s2 >> s3; for (int i = 0; i < n; ++i){ if (s1[i] == s2[i]){ s4 += s1[i]; } else{ if ((s1[i] == 'J' && s2[i] == 'O')||(s1[i] == 'O' && s2[i] == 'J')){ s4 += 'I'; } if ((s1[i] == 'J' && s2[i] == 'I')||(s1[i] == 'I' && s2[i] == 'J')){ s4 += 'O'; } if ((s1[i] == 'I' && s2[i] == 'O')||(s1[i] == 'O' && s2[i] == 'I')){ s4 += 'J'; } } } for (int i = 0; i < n; ++i){ if (s1[i] == s3[i]){ s5 += s1[i]; } else{ if ((s1[i] == 'J' && s3[i] == 'O')||(s1[i] == 'O' && s3[i] == 'J')){ s5 += 'I'; } if ((s1[i] == 'J' && s3[i] == 'I')||(s1[i] == 'I' && s3[i] == 'J')){ s5 += 'O'; } if ((s1[i] == 'I' && s3[i] == 'O')||(s1[i] == 'O' && s3[i] == 'I')){ s5 += 'J'; } } } for (int i = 0; i < n; ++i){ if (s3[i] == s2[i]){ s6 += s3[i]; } else{ if ((s3[i] == 'J' && s2[i] == 'O')||(s3[i] == 'O' && s2[i] == 'J')){ s6 += 'I'; } if ((s3[i] == 'J' && s2[i] == 'I')||(s3[i] == 'I' && s2[i] == 'J')){ s6 += 'O'; } if ((s3[i] == 'I' && s2[i] == 'O')||(s3[i] == 'O' && s2[i] == 'I')){ s6 += 'J'; } } } for (int i = 0; i < n; ++i){ if (s1[i] == s6[i]){ s7 += s1[i]; } else{ if ((s1[i] == 'J' && s6[i] == 'O')||(s1[i] == 'O' && s6[i] == 'J')){ s7 += 'I'; } if ((s1[i] == 'J' && s6[i] == 'I')||(s1[i] == 'I' && s6[i] == 'J')){ s7 += 'O'; } if ((s1[i] == 'I' && s6[i] == 'O')||(s1[i] == 'O' && s6[i] == 'I')){ s7 += 'J'; } } } for (int i = 0; i < n; ++i){ if (s5[i] == s2[i]){ s8 += s5[i]; } else{ if ((s5[i] == 'J' && s2[i] == 'O')||(s5[i] == 'O' && s2[i] == 'J')){ s8 += 'I'; } if ((s5[i] == 'J' && s2[i] == 'I')||(s5[i] == 'I' && s2[i] == 'J')){ s8 += 'O'; } if ((s5[i] == 'I' && s2[i] == 'O')||(s5[i] == 'O' && s2[i] == 'I')){ s8 += 'J'; } } } for (int i = 0; i < n; ++i){ if (s3[i] == s4[i]){ s9 += s3[i]; } else{ if ((s3[i] == 'J' && s4[i] == 'O')||(s3[i] == 'O' && s4[i] == 'J')){ s9 += 'I'; } if ((s3[i] == 'J' && s4[i] == 'I')||(s3[i] == 'I' && s4[i] == 'J')){ s9 += 'O'; } if ((s3[i] == 'I' && s4[i] == 'O')||(s3[i] == 'O' && s4[i] == 'I')){ s9 += 'J'; } } } int q; cin >> q; string ej; cin >> ej; if (ej == s1 || ej == s2 || ej == s3|| ej == s4|| ej == s5|| ej == s6|| ej == s7|| ej == s8|| ej == s9){ cout << "Yes" << endl; } else{ cout << "No" << endl; } for (int i = 0; i < q; ++i){ int l, r; cin >> l >> r; char c; cin >> c; for (int i = l-1; i < r; ++i){ ej[i] = c; } if (ej == s1 || ej == s2 || ej == s3|| ej == s4|| ej == s5|| ej == s6|| ej == s7|| ej == s8|| ej == s9){ cout << "Yes" << endl; } else{ cout << "No" << endl; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...