#include<bits/stdc++.h>
using namespace std;
int vis[100001],x,y,t,help,d[1000001];
map<pair<int,int>,int> mp;
vector<int> adj[100000];
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
int DistanceSum(int N, int *X, int *Y) {
int sum = 0;
for (int i = 0; i < N; i++)
mp[{X[i],Y[i]}] = i;
for (int i = 0; i < N;i ++) {
for (int j = 0; j < 4; j++) {
x = X[i] + dx[j];
y = Y[i] + dy[j];
t = mp[{x,y}];
if (t) adj[i].push_back(t);
}
}
for (int i = 0; i < N; i++) {
help++;
queue<int> q;
q.push(i);
d[i] = 0;
vis[i] = help;
while (!q.empty()) {
x = q.front();
q,pop();
sum += d[x];
for (int i:adj[x]) {
if (vis[i] != help ) {
vis[i] = help;
d[i] = d[x] + 1;
q.push(x);
}
}
if (sum >= 1e9) sum -= 1e9;
}
}
return sum/2;
}
Compilation message
city.cpp: In function 'int DistanceSum(int, int*, int*)':
city.cpp:28:7: error: 'pop' was not declared in this scope
q,pop();
^~~
city.cpp:28:7: note: suggested alternative: 'pow'
q,pop();
^~~
pow