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;
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define endl '\n'
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
const int mod = 1e9 + 7;
const int N = 1e6 + 15;
const ll inf = 1e18;
vector<int> coin_flips(vector<int> b, int c) {
vector<int> flips(1);
int n = 64;
int val = 0;
for (int i=0;i<n;i++){
if (b[i]) val += i;
}
val %= n;
int ans =0;
if (c > val){
if (!b[c-val]) ans = c-val;
else if (b[val-c+64]) ans = val-c+64;
}
else {
if (b[val-c]) ans = val-c;
else if (!b[64-(val-c)]) ans = 64-(val-c);
}
flips[0] = ans;
return flips;
}
int find_coin(vector<int> b) {
int ans = 0;
for (int i=0;i<64;i++){
if (b[i]) ans ^= i;
}
return ans;
}
# | 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... |