| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1361394 | avahw | Coins (IOI17_coins) | C++20 | 3 ms | 592 KiB |
#include "coins.h"
#include <bits/stdc++.h>
using namespace std;
int get_val(vector<int>& b, int s){
int res = 0;
for(int i = 0; i <= s; i++){
res += b[i] * pow(2, i);
}
return res;
}
std::vector<int> coin_flips(std::vector<int> b, int c) {
vector<int> flips;
vector<vector<int>> lookup(3);
lookup[0] = {0, 0, 0, 7, 0, 7, 7, 7};
lookup[1] = {1, 1, 6, 1, 6, 1, 6, 6};
lookup[2] = {4, 3, 3, 3, 4, 4, 4, 3};
int curr = get_val(b, 2);
int message = lookup[c][curr];
for(int i = 2; i >= 0; i--){
if(message >= pow(2, i)){
if(b[i] != 1) flips.push_back(i);
message -= pow(2, i);
}
else{
if(b[i] != 0) flips.push_back(i);
}
}
if(flips.size() == 0) flips.push_back(63);
return flips;
}
int find_coin(std::vector<int> b) {
int message = get_val(b, 2);
vector<int> key(8);
key[0] = 0; key[7] = 0;
key[1] = 1; key[6] = 1;
key[3] = 2; key[4] = 2;
return key[message];
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
