| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 547451 | Olympia | Plus Minus (BOI17_plusminus) | C++17 | 1 ms | 324 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cmath>
#include <iostream>
#include <set>
#include <climits>
#include <algorithm>
#include <cassert>
#include <vector>
#include <iomanip>
#include <type_traits>
#include <string>
#include <queue>
#include <map>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;
int64_t solve (int N, int M, vector<pair<pair<int,int>, bool>> points) {
map<int,int> myMap;
for (auto& p: points) {
if (myMap[p.first.first] != (p.first.second % 2) ^ p.second) {
return 0;
}
myMap[p.first.first] = (p.first.second % 2) ^ p.second;
}
return pow(2, N - myMap.size());
}
int64_t overcount (vector<pair<pair<int,int>, bool>> points) {
if (points.empty()) return 2;
bool f[2];
f[0] = f[1] = true;
for (auto& p: points) {
f[(p.first.first % 2) ^ (p.first.second % 2) ^ p.second] = false;
}
return f[0] + f[1];
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N, M, K; cin >> N >> M >> K;
vector<pair<pair<int,int>, bool>> points(K);
for (int i = 0; i < K; i++) {
char c; cin >> c;
cin >> points[i].first.first >> points[i].first.second;
points[i].second = (c == '+');
}
int64_t ans = 0;
//cout << solve(N, M, points) << '\n';
ans += solve(N, M, points);
for (int i = 0; i < K; i++) {
swap(points[i].first.first, points[i].first.second);
}
ans += solve(M, N, points);
//cout << solve(M, N, points) << '\n';
//cout << overcount(points) << '\n';
cout << ans;
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
