QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#233152 | #2526. Imprecise Computer | BUET_Twilight# | WA | 0ms | 3716kb | C++23 | 1.9kb | 2023-10-31 14:10:16 | 2023-10-31 14:10:16 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
#define getbit(n, i) (((n) & (1LL << (i))) != 0)
#define setbit0(n, i) ((n) & (~(1LL << (i))))
#define setbit1(n, i) ((n) | (1LL << (i)))
#define togglebit(n, i) ((n) ^ (1LL << (i)))
#define lastone(n) ((n) & (-(n)))
char gap = 32;
#define int long long
#define ll long long
#define lll __int128_t
#define pb push_back
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll hashPrime = 1610612741;
void solve() {
int n; cin >> n;
int a[n + 1];
for(int i = 1; i <= n; i++) {
cin >> a[i];
}
if(a[1] == 2) {
cout << "NO\n";
return;
}
int r1 = 0;
int r2 = 0;
if(a[1] == 0) r1 = 1, r2 = 1;
else r1 = 1, r2 = 0;
for(int i = 2; i <= n; i++) {
int cr1 = 1 - r1;
int cr2 = 1 - r2;
if(cr1 == cr2) {
if(a[i] == 2) {
cout << "NO\n";
return;
}
else {
if(a[i] == 0) r1 = 1, r2 = 1;
else r1 = 1, r2 = 0;
}
}
else {
if(a[i] == 2) {
if(cr1 == 1) r1 = 1, r2 = 0;
else r1 = 0, r2 = 1;
}
else {
if(a[i] == 0) {
if(cr1 == 1) r1 = 0, r2 = 1;
else r1 = 1, r2 = 0;
}
else {
r1 = 1, r2 = 1;
}
}
}
}
cout << "YES\n";
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3592kb
input:
10 1 2 3 3 3 3 2 1 2 2
output:
NO
result:
ok single line: 'NO'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3716kb
input:
10 0 0 0 0 0 0 0 0 0 1
output:
YES
result:
wrong answer 1st lines differ - expected: 'NO', found: 'YES'