제출 #1284101

#제출 시각아이디문제언어결과실행 시간메모리
1284101lmquanPlus Minus (BOI17_plusminus)C++20
100 / 100
88 ms9812 KiB
#define taskname "" #include <bits/stdc++.h> using namespace std; const long long kMod = 1e9 + 7; long long Power(long long a, long long b) { a %= kMod; long long c = 1; for (; b > 0; b >>= 1, a = a * a % kMod) { if (b & 1) { c = c * a % kMod; } } return c; } int main() { if (fopen(taskname".inp", "r")) { freopen(taskname".inp", "r", stdin); freopen(taskname".out", "w", stdout); } ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, m, k; cin >> n >> m >> k; map<int, int> u, v; vector<char> b(2, '?'); bool a1 = true, a2 = true, a3 = true; for (int i = 1; i <= k; i++) { char z; int y, x; cin >> z >> y >> x; int p = (((z == '+' ? 1 : 0) - x) % 2 == 0 ? 2 : 1); if (u[y] > 0 && u[y] != p) { a1 = false; } u[y] = p; int q = (((z == '+' ? 1 : 0) - y) % 2 == 0 ? 2 : 1); if (v[x] > 0 && v[x] != q) { a2 = false; } v[x] = q; int r = (y + x) % 2; if (b[r] != '?' && b[r] != z) { a3 = false; } b[r] = z; } long long s = ((a1 ? Power(2, n - u.size()) : 0) + (a2 ? Power(2, m - v.size()) : 0) - a3 - (k == 0)) % kMod; if (s < 0) { s += kMod; } cout << s; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

plusminus.cpp: In function 'int main()':
plusminus.cpp:19:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |     freopen(taskname".inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
plusminus.cpp:20:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |     freopen(taskname".out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...