Created
April 10, 2018 16:18
-
-
Save lovasoa/45d6d2b6745eedcee228360eed203d21 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
bool is_mirror(int n) { | |
if (n<=0) return true; | |
int n1, n2; | |
cin >> n1; | |
if (n==1) return true; | |
bool inner_mirror = is_mirror(n-2); | |
cin >> n2; | |
return inner_mirror && n1 == n2; | |
} | |
int main(void) { | |
int n; | |
cin >> n; | |
cout << (is_mirror(n) ? "YES" : "NO") << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment