Hello force coders, I was just solving a problem (1324A - Yet Another Tetris Problem) and my code was this:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define li(n) for(int i=0; i<n; i++)
void test();
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t = 1;
cin >> t;
while(t--) {
test();
cout << endl;
}
}
void test() {
int n;
cin >> n;
int pre, cur;
cin >> pre;
li(n-1) {
cin >> cur;
pre%=2;
cur%=2;
if(pre==cur) continue;
else {
cout << "NO";
return;
}
}
cout << "YES";
return;
}
and the tried to check my solution by given test cases, but the operation of taking input was amazingly wonderful. Input:
4
3
1 1 3
4
1 1 2 1
2
11 11
1
100
My Code's Output: (also containing inputs)
4
3
1 1 3
YES
4
1 1 2 1
NO
2 // how?
YES
11 11
1
100
NO
I was wondered why would something like this happen in C++. Likewise I had same problem on some interactive problems before. That Was (1305D - Kuroni and the Celebration) = (72397838)
Any idea?