이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h> 
#define X first
#define Y second
#define ll long long 
using namespace std; 
const int MOD = 1e9 + 7; 
vector<pair< int, int >> l, c;
int power(int x, int exp){ 
	int out = 1;
	int mult = x; 
	while(exp){ 
		if(exp & 1)
			out = ((ll) out * x) % MOD;
		x = ((ll) x * x) % MOD;
		exp /= 2;
	}
	return out;
}
int count(vector< pair<int, bool> > &r, vector< pair<int, bool> > &s, int rn, int sn, int n){ 
	map<int, bool> m; 
	for(int i = 0; i < n; i ++){ 
		int x = r[i].X;
		int y = s[i].X;
		bool sign = r[i].Y;
		if(!m.count(y)) m[y] = !(x & 1) | sign;
		else if (m[y] != (!(x & 1) | sign))	
			return 0;
	}
	return power(2, sn - m.size());
}
int main(){ 
	ios_base::sync_with_stdio(false);
	int rn, sn, n;
	cin >> rn >> sn;
	cin >> n; 
	bool board1 = true;
	bool board2 = true;
	vector<pair< int, bool >> r, s; 
	for(int i = 0; i < n; i ++){ 
		int x, y; 
		char c;
		cin >> c >> x >> y; x--; y--; 
		bool sign = (c == '+');
		board1 &= (!(!(x & 1) ^ !(y & 1)) ^ sign);
		board2 &= (!(!(x & 1) ^ !(y & 1)) ^ !sign);		
		
		r.push_back({x, sign});
		s.push_back({y, sign});	
	}
	//cout << "check: "<< (pow(2, 3) == 8) << "\n";
	cout << count(r, s, rn, sn, n) << ' ' << count(s, r, sn, rn, n) << ' ' <<  board1 << ' ' << board2;
	//cout << "\n" << char(254) << "\n";
	return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
plusminus.cpp: In function 'int power(int, int)':
plusminus.cpp:15:6: warning: unused variable 'mult' [-Wunused-variable]
   15 |  int mult = x;
      |      ^~~~| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |