This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
template <typename T, int sz> using ar = array<T, sz>;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define endl '\n'
vector<int> coin_flips(vector<int> b, int c) {
vector<int> turn;
vector<int> final_one = {0, 0, 0};
vector<int> final_two = {0, 0, 0};
if(c == 0) {
final_one = {1, 0, 0};
final_two = {0, 1, 1};
} else if(c == 1) {
final_one = {0, 1, 0};
final_two = {1, 0, 1};
} else {
final_one = {0, 0, 1};
final_two = {1, 1, 0};
}
vector<int> c1;
vector<int> c2;
for(int i = 0; i < 3; i++) {
if(b[i] != final_one[i]) {
c1.pb(i);
}
if(b[i] != final_two[i]) {
c2.pb(i);
}
}
if(c1.size() == 0 && c2.size() == 0) {
turn.pb(63);
} else if(c1.size() == 1) {
turn.pb(c1[0]);
} else if(c2.size() == 1) {
turn.pb(c2[0]);
}
return turn;
}
int find_coin(vector<int> b) {
int cnt[2] = {0, 0};
cnt[b[0]]++;
cnt[b[1]]++;
cnt[b[2]]++;
if(cnt[0] == 1) {
for(int i = 0; i < 3; i++) {
if(b[i] == 0) {
return i;
}
}
}
if(cnt[1] == 1) {
for(int i = 0; i < 3; i++) {
if(b[i] == 1) {
return i;
}
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |