# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
558663 | 2022-05-08T00:34:54 Z | Olympia | Bitwise (BOI06_bitwise) | C++17 | 1 ms | 224 KB |
#include <bits/stdc++.h> using namespace std; bool canDo (vector<pair<int,int>> &v, int x) { //can we achieve some supermask of x bool change = false; for (auto& p: v) { if ((int)log2(p.first) == (int)log2(p.second)) { int bt = (1 << (int)log2(p.first)); if (x & bt) x -= bt; p.first -= bt, p.second -= bt; change = true; } } for (auto& p: v) { if ((1 << (int)log2(p.second)) > x) { return true; } } int cntr = 0; for (auto& p: v) { cntr += ((1 << (int)log2(p.second)) == (1 << (int)log2(x))); } if (cntr >= 2) { return true; } for (auto& p: v) { if ((int)log2(p.second) == (int)log2(x)) { int bt = log2(x); p.second -= (1 << bt); } } return false; } int main() { int n, m; cin >> n >> m; int tot[m]; for (int i = 0; i < m; i++) { cin >> tot[i]; } vector<vector<pair<int,int>>> vec; int ind = 0; for (int i = 0; i < m; i++) { vec.emplace_back(); while (tot[i]--) { pair<int,int> p; cin >> p.first >> p.second; vec.back().push_back(p); } } cout << canDo(vec.back(), 4); return 0; for (int i = 0; i < vec.size(); i++) { for (auto& p: vec[i]) { cout << p.first << " " << p.second << " | "; } cout << '\n'; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 224 KB | Output isn't correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Incorrect | 1 ms | 212 KB | Output isn't correct |
5 | Incorrect | 0 ms | 212 KB | Output isn't correct |
6 | Incorrect | 0 ms | 212 KB | Output isn't correct |
7 | Incorrect | 1 ms | 212 KB | Output isn't correct |
8 | Incorrect | 0 ms | 212 KB | Output isn't correct |
9 | Incorrect | 1 ms | 212 KB | Output isn't correct |
10 | Incorrect | 0 ms | 212 KB | Output isn't correct |
11 | Incorrect | 1 ms | 212 KB | Output isn't correct |
12 | Incorrect | 0 ms | 212 KB | Output isn't correct |
13 | Incorrect | 0 ms | 212 KB | Output isn't correct |
14 | Incorrect | 0 ms | 212 KB | Output isn't correct |
15 | Incorrect | 0 ms | 212 KB | Output isn't correct |
16 | Incorrect | 0 ms | 212 KB | Output isn't correct |
17 | Incorrect | 1 ms | 212 KB | Output isn't correct |
18 | Incorrect | 1 ms | 212 KB | Output isn't correct |
19 | Incorrect | 1 ms | 212 KB | Output isn't correct |
20 | Incorrect | 0 ms | 212 KB | Output isn't correct |