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>
#define ll long long
using namespace std;
int dif(string s1,string s2)
{
int dd=0;
for(int i=0;i<3;i++)if(s1!=s2)dd++;
return dd;
}
vector<int> coin_flips(vector<int> b, int c)
{
string ac[4]={"000","111","101","010"};
vector<int> flips;
string s="";
for(int i=0;i<3;i++)s+=char(b[i]+'0');
int cur=0;
if(c<2)
{
if(c>0)cur+=2;
string s1=ac[cur],s2=ac[cur+1];
if(s==s1||s==s2)
{
flips.push_back(9);
return flips;
}
string comp;
if(dif(s,s1)==1)comp=s1;
else comp=s2;
for(int i=0;i<3;i++)
{
if(s[i]!=comp[i])flips.push_back(i);
}
return flips;
}
vector<int>v;
if(s==ac[0]||s==ac[1]||s==ac[2]||s==ac[3])v.push_back(2);
else v.push_back(9);
return v;
}
int find_coin(vector<int> b)
{
int ret=0;
string ac[4]={"000","111","101","010"};
string s="";
for(int i=0;i<3;i++)s+=char(b[i]+'0');
if(s==ac[0]||s==ac[1])return 0;
else if(s==ac[2]||s==ac[3])return 1;
return 2;
}
Compilation message (stderr)
coins.cpp: In function 'int find_coin(std::vector<int>)':
coins.cpp:43:9: warning: unused variable 'ret' [-Wunused-variable]
43 | int ret=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... |