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 "coins.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> coin_flips(vector<int> b, int c){
vector<int> flips;
int cnt[2] = {0, 0};
cnt[0] += (b[0] == 0); cnt[0] += (b[1] == 0); cnt[0] += (b[2] == 0);
cnt[1] += (b[0] == 1); cnt[1] += (b[1] == 1); cnt[1] += (b[2] == 1);
int x = 0;
if(cnt[1] > cnt[0]) x = 1;
if(b[c] == x){
if(cnt[x] == 3) flips.push_back(c);
else if(c != 0 && b[0] == x) flips.push_back(0);
else if(c != 1 && b[1] == x) flips.push_back(1);
else if(c != 2 && b[2] == x) flips.push_back(2);
} else{
flips.push_back(3);
}
return flips;
}
int find_coin(vector<int> b){
int coin = 0;
if(b[0] == b[2]) coin = 1;
if(b[0] == b[1]) coin = 2;
return coin;
}
# | 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... |