|
|
back to boardPlease Help, TLE #21 #include<iostream> using namespace std; int arr[500005]; int main() { int n; cin >> n; long long int a; int p = 0; arr[0] = -1; for (int i = 0; i < n; i++) {
cin >> a; if (a == arr[p] || p == 0) { p++; arr[p] = a; } else p--; }
cout << arr[1] << endl;
} Edited by author 12.12.2014 12:48 Edited by author 12.12.2014 12:48 |
|
|