#include <bits/stdc++.h>
#include "coins.h"
using namespace std;
#define pb push_back
#define mp make_pair
#define pii pair<ll, ll>
#define fi first
#define se second
#define elif else if
#define show(x) cout<<#x<<" is "<<x<<"\n";
#define show2(x,y) cout<<#x<<" is "<<x<<" "<<#y<<" is "<<y<<"\n";
#define show3(x,y,z) cout<<#x<<" is "<<x<<" "<<#y<<" is "<<y<<" "<<#z<<" is "<<z<<"\n";
#define showarr(x) cout<<#x<<": ";for(auto &i:x)cout<<i<<" ";cout<<"\n";
typedef long long ll;
typedef unsigned long long ull;
std::vector<int> coin_flips(std::vector<int> b, int c) {
vector<bool> arr;
vector<bool> ans;
ll n, huh;
arr.resize(6, 0);
ans.resize(6, 0);
n = 8;
for (ll i = 0; i < n*n; i++) {
if (b[i]|0) continue;
for (ll j = 0; j < 6; j++) {
if ((i>>j) & 1) {
arr[j] = !arr[j];
}
}
}
huh = 0;
for (ll i = 6-1; i >= 0; i--) {
ans[i] = (arr[i]^(c>>i & 1));
huh <<= 1;
huh |= ans[i];
}
std::vector<int> flips(1);
flips[0] = huh;
return flips;
}
int find_coin(std::vector<int> b) {
vector<bool> arr;
ll n, huh;
arr.resize(6, 0);
n = 8;
for (ll i = 0; i < n*n; i++) {
if (b[i]|0) continue;
for (ll j = 0; j < 6; j++) {
if ((i>>j) & 1) {
arr[j] = !arr[j];
}
}
}
huh = 0;
for (ll i = 6-1; i >= 0; i--) {
huh <<= 1;
huh |= arr[i];
}
return huh;
}
// 0-63 represented in 6 bits. therefore there are 6 parities
/*
- Use getline(cin, [string var]); to grab the ENTIRE string because it is safer
- "typedef" to shorten data types, ex long long -> ll
- #define to change commands
- __LINE__ shows the line of code it's currently running
- #v shows the name of the variable itself
- vector<data_type> variable_name(n, x) creates a vector of size n, all containing value x
- stable_partition(l, r, f) means that from iterator l to r, a function f will be executed. {a<ll>, b<ll>}.
* If f's value if true, the value of iterator relocated to a. else go to b. replaces the value of iterator from l to r.
- LLONG_MAX is max of long long
RUNNING INTERACTIVE PROBLEMS:
- In terminal: "cd [folder_name]" to transverse
- g++ [headerfiles] [funct files] [grader file]
- ./[exec file created]
*/
# | 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... |