0_0_37846451_22496.cpp:4:12: error: 'MAXN' was not declared in this scope
int fa[MAXN], rank[MAXN];
^
0_0_37846451_22496.cpp:4:24: error: 'MAXN' was not declared in this scope
int fa[MAXN], rank[MAXN];
^
0_0_37846451_22496.cpp: In function 'void UF::init(int)':
0_0_37846451_22496.cpp:9:13: error: 'fa' was not declared in this scope
fa[i] = i;
^
0_0_37846451_22496.cpp:10:13: error: 'rank' was not declared in this scope
rank[i] = 1;
^
0_0_37846451_22496.cpp: In function 'int UF::find(int)':
0_0_37846451_22496.cpp:15:21: error: 'fa' was not declared in this scope
return x == fa[x] ? x : (fa[x] = find(fa[x]));
^
0_0_37846451_22496.cpp: In function 'void UF::merge(int, int)':
0_0_37846451_22496.cpp:20:13: error: 'rank' was not declared in this scope
if (rank[x] <= rank[y])
^
0_0_37846451_22496.cpp:21:13: error: 'fa' was not declared in this scope
fa[x] = y;
^
0_0_37846451_22496.cpp:23:13: error: 'fa' was not declared in this scope
fa[y] = x;
^
0_0_37846451_22496.cpp:24:13: error: 'rank' was not declared in this scope
if (rank[x] == rank[y] && x != y)
^
0_0_37846451_22496.cpp: At global scope:
0_0_37846451_22496.cpp:32:7: error: 'MAXN' was not declared in this scope
int p[MAXN], pos[MAXN];
^
0_0_37846451_22496.cpp:32:18: error: 'MAXN' was not declared in this scope
int p[MAXN], pos[MAXN];
^
0_0_37846451_22496.cpp: In function 'void slove()':
0_0_37846451_22496.cpp:34:5: error: 'cin' was not declared in this scope
cin >> n;
^
0_0_37846451_22496.cpp:36:40: error: 'p' was not declared in this scope
for (int i = 1; i <= n; i++)cin >> p[i], pos[p[i]] = i;
^
0_0_37846451_22496.cpp:36:46: error: 'pos' was not declared in this scope
for (int i = 1; i <= n; i++)cin >> p[i], pos[p[i]] = i;
^
0_0_37846451_22496.cpp:37:5: error: 'vector' was not declared in this scope
vector<vector<pair<int, int>>>e(n);
^
0_0_37846451_22496.cpp:37:19: error: 'pair' was not declared in this scope
vector<vector<pair<int, int>>>e(n);
^
0_0_37846451_22496.cpp:37:24: error: expected primary-expression before 'int'
vector<vector<pair<int, int>>>e(n);
^
0_0_37846451_22496.cpp:39:21: error: 'p' was not declared in this scope
int w = abs(p[i] - p[i - 1]);
^
0_0_37846451_22496.cpp:39:36: error: 'abs' was not declared in this scope
int w = abs(p[i] - p[i - 1]);
^
0_0_37846451_22496.cpp:40:9: error: 'e' was not declared in this scope
e[w].push_back({ i - 1,i });
^
0_0_37846451_22496.cpp:42:20: error: 'sqrt' was not declared in this scope
int sq = sqrt(n);
^
0_0_37846451_22496.cpp:45:30: error: 'abs' was not declared in this scope
int w = abs(i - j) * abs(p[i] - p[j]);
^
0_0_37846451_22496.cpp:45:38: error: 'p' was not declared in this scope
int w = abs(i - j) * abs(p[i] - p[j]);
^
0_0_37846451_22496.cpp:46:23: error: 'e' was not declared in this scope
if (w < n)e[w].push_back({ i, j });
^
0_0_37846451_22496.cpp:51:30: error: 'abs' was not declared in this scope
int w = abs(i - j) * abs(pos[i] - pos[j]);
^
0_0_37846451_22496.cpp:51:38: error: 'pos' was not declared in this scope
int w = abs(i - j) * abs(pos[i] - pos[j]);
^
0_0_37846451_22496.cpp:52:23: error: 'e' was not declared in this scope
if (w < n)e[w].push_back({ pos[i], pos[j] });
^
0_0_37846451_22496.cpp:55:5: error: 'll' was not declared in this scope
ll ans = 0;
^
0_0_37846451_22496.cpp:58:23: error: 'e' was not declared in this scope
for (auto p : e[w]) {
^
0_0_37846451_22496.cpp:60:29: error: 'v' was not declared in this scope
if (UF::same(u, v))continue;
^
0_0_37846451_22496.cpp:61:26: error: 'v' was not declared in this scope
UF::merge(u, v);
^
0_0_37846451_22496.cpp:62:13: error: 'ans' was not declared in this scope
ans += w;
^
0_0_37846451_22496.cpp:69:5: error: 'cout' was not declared in this scope
cout << ans << endl;
^
0_0_37846451_22496.cpp:69:13: error: 'ans' was not declared in this scope
cout << ans << endl;
^
0_0_37846451_22496.cpp:69:20: error: 'endl' was not declared in this scope
cout << ans << endl;
^
|