| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1360760 | avahw | Coins (IOI17_coins) | C++20 | 4 ms | 660 KiB |
#include "coins.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> coin_flips(std::vector<int> b, int c) {
vector<int> flips;
// encode row in row 0
int row = c / 8;
int col = c % 8;
// encode row in row 1
for(int i = 2; i >= 0; i--){
if(row >= pow(2, i)){
row -= pow(2, i);
if(b[i] != 1) flips.push_back(i);
}
else{
if(b[i] != 0) flips.push_back(i);
}
}
for(int i = 2; i >= 0; i--){
if(col >= pow(2, i)){
col -= pow(2, i);
if(b[i + 8] != 1){
flips.push_back(i + 8);
}
}
else{
if(b[i + 8] != 0){
flips.push_back(i + 8);
}
}
}
if(flips.size() == 0) flips.push_back(63);
return flips;
}
int find_coin(std::vector<int> b) {
int row = 0;
int col = 0;
// get row from row 0
for(int i = 0; i < 3; i++){
row += pow(2, i) * b[i];
}
// get col from row 1
for(int i = 0; i < 3; i++){
col += pow(2, i) * b[i + 8];
}
return (row * 8) + col;
}
Compilation message (stderr)
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
