11989 | 2024-11-23 10:00:18 | hunzombi | Bináris Sakk | cpp17 | Compilation error |
#include <bits/stdc++.h>
#define MOD 1e9 + 7;
using namespace std;
int R, C, N;
int x, y;
struct node{
int r;
int c;
int sum;
int dif;
bool sz;
} a;
vector<node> L[200001];
vector<node> vec;
bool mysort1(node l, node r) {
return l.c < r.c;
}
bool mysort2(node l, node r) {
return l.r < r.r;
}
bool mysort3(node l, node r) {
return l.sum < r.sum;
}
bool mysort4(node l, node r) {
return l.dif < r.dif;
}
void dfs(node n){
queue<node> Q;
Q.push(n);
while (!Q.empty()){
n = Q.top();
Q.pop();
}
}
int main()
{
cin >> R >> C >> N;
for (int i=0; i < N; i++){
cin >> x >> y;
a.c = x;
a.r = y;
a.sum = x + y;
a.dif = x - y;
vec.push_back(a);
}
sort(vec.begin(), vec.end(), mysort1);
for (int i=0; i < vec.size(); i++){
if (i >= 1 && vec[i].c == vec[i - 1].c){
L[i].push_back(vec[i - 1]);
}
if (i < vec.size() - 1 && vec[i].c == vec[i + 1].c){
L[i].push_back(vec[i + 1]);
}
}
sort(vec.begin(), vec.end(), mysort2);
for (int i=0; i < vec.size(); i++){
if (i >= 1 && vec[i].r == vec[i - 1].r){
L[i].push_back(vec[i - 1]);
}
if (i < vec.size() - 1 && vec[i].r == vec[i + 1].r){
L[i].push_back(vec[i + 1]);
}
}
sort(vec.begin(), vec.end(), mysort3);
for (int i=0; i < vec.size(); i++){
if (i >= 1 && vec[i].sum == vec[i - 1].sum) {
L[i].push_back(vec[i - 1]);
}
if (i < vec.size() - 1 && vec[i].sum == vec[i + 1].sum){
L[i].push_back(vec[i + 1]);
}
}
sort(vec.begin(), vec.end(), mysort4);
for (int i=0; i < vec.size(); i++){
if (i >= 1 && vec[i].dif == vec[i - 1].dif) {
L[i].push_back(vec[i - 1]);
}
if (i < vec.size() - 1 && vec[i].dif == vec[i + 1].dif){
L[i].push_back(vec[i + 1]);
}
}
for (int i=0; i < vec.size(); i++){
if (!vec[i].sz){
dfs(vec[i]);
}
res = (res * 2) % MOD;
}
return 0;
}
open /var/local/lib/isolate/400/box/a.out: no such file or directory
main.cpp: In function 'void dfs(node)':
main.cpp:40:15: error: 'class std::queue<node>' has no member named 'top'; did you mean 'pop'?
40 | n = Q.top();
| ^~~
| pop
main.cpp: In function 'int main()':
main.cpp:106:9: error: 'res' was not declared in this scope
106 | res = (res * 2) % MOD;
| ^~~