제출 #280437

#제출 시각아이디문제언어결과실행 시간메모리
280437ElyesChaabouni이상적인 도시 (IOI12_city)C++14
컴파일 에러
0 ms0 KiB
/*#pragma GCC optimize("O3")*/ #include<bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //#define ordered_set tree<int, null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> #define eps 1e-9 #define MOD1 998244353 #define MOD2 1000000007 #define INV_10 299473306 #define INF 1000000000 #define PI 3.14159265358979323846 using namespace std; int inc[4][2]={{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; int DistanceSum(int N, int *X, int *Y) { long long ans=0; for(int i = 0; i < n; i++) { set<pair<int, int> >s; for(int j = 0; j < n; j++) { if(j!=i) { s.insert(make_pair(X[j], Y[j])); } } int nb=0, idx=0; vector<pair<int, int> >bfs; while(!s.empty()) { int l=bfs.size(); for(int j = idx; j < l; j++) { ans+=nb; ans%=MOD2; for(int k = 0; k < 4; k++) { int xx=bfs[j].first+inc[k][0], yy=bfs[j].second+inc[k][1]; if(s.count(make_pair(xx, yy))) { s.erase(make_pair(xx, yy)); bfs.push_back(make_pair(xx, yy)); } } } nb++; idx=l; } } ans*=(500000004); ans%=MOD2; return ans; } //size

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

city.cpp: In function 'int DistanceSum(int, int*, int*)':
city.cpp:17:21: error: 'n' was not declared in this scope
   17 |  for(int i = 0; i < n; i++)
      |                     ^