제출 #865347

#제출 시각아이디문제언어결과실행 시간메모리
865347vjudge1Birthday gift (IZhO18_treearray)C++17
컴파일 에러
0 ms0 KiB
// Bolatulu #include <bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; typedef double db; // #define int long long #define kanagattandirilmagandiktarinizdan ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); #define pb push_back #define F first #define S second #define md (tl+tr)/2 #define TL v+v,tl,mid #define TR v+v+1,mid+1,tr #pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize("Ofast,unroll-loops,fast-math,O3") using namespace std; int binpow(int a,int n,int M) { if (n==0) return 1; if (n%2!=0) return (a * binpow(a,n-1,M))%M; int z=binpow(a,n/2,M); return (z*z)%M; } const ll INF = 1e18; const int N = 3e5+7; const int M = 1e9+7; const ll HZ = 1e5; const int MAX = INT_MAX; const int MIN = INT_MIN; const db pi = 3.141592653; const int P=31; int n,m,q,tin[N],tout[N],t,up[20][N],lc[2001][2001],a[N]; vector <int> g[N]; vector <vector <vector <int>>> d(2001,vector <vector <int>> (2001)); void dfs(int v,int p) { tin[v]=++t; up[0][v]=p; for (auto now : g[v]) { if (now==p) continue; dfs(now,v); } tout[v]=++t; } bool parent(int a,int b) { return tin[a]<=tin[b] and tout[b]<=tout[a]; } void prepare(int pw) { if (pw==20) return; for (int i=1;i<=n;i++) up[pw][i]=up[up[pw-1][i]][i]; prepare(pw+1); } int lca(int a,int b) { if (parent(a,b)) return a; if (parent(b,a)) return b; for (int i=19;i>=0;i--) if (up[i][a] and !parent(up[i][a],b)) a=up[i][a]; return up[0][a]; } void solve() { cin >> n >> m >> q; for (int i=1;i<n;i++) { int u,v; cin >> u >> v; g[u].push_back(v), g[v].push_back(u); } for (int i=1;i<=m;i++) cin >> a[i]; dfs(1,0), prepare(1); for (int i=1;i<=n;i++) for (int j=i+1;j<=n;j++) lc[i][j]=lca(i,j), d[lc[i][j]][i].push_back(j), d[lc[i][j]][j].push_back(i); for (int i=1;i<=n;i++) for (int j=1;j<=n;j++) sort(d[i][j].begin(),d[i][j].end()); vector <vector <set <int>>> s(2001,vector <set<int>>(2001)); vector <set <int>> poss(2001); for (int i=1;i<=m;i++) poss[a[i]].insert(i); for (int i=1;i<=n;i++) { for (int j=1;j<=n;j++) } while (q--) { int tp,l,r,v,pos; cin >> tp; if (tp==1) { cin >> pos >> v; a[pos]=v; } else { cin >> l >> r >> v; int pos1=-1,pos2=-1; for (int i=l;i<=r;i++) { if (*s[v][a[i]].lower_bound(l)<=r) pos1=*s[v][a[i]].lower_bound(l), pos2=i; } cout << pos1 << ' ' << pos2 << '\n'; } } } signed main() { // freopen("lca.in", "r", stdin); // freopen("lca.out", "w", stdout); kanagattandirilmagandiktarinizdan int test = 1, count = 1; // cin >> test; while (test--) { // cout << "Case " << count << ":\n"; solve(); if (test) // cout << '\n'; count++; } return 0; }

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

treearray.cpp: In function 'void solve()':
treearray.cpp:100:5: error: expected primary-expression before '}' token
  100 |     }
      |     ^