Submission #827556

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8275562023-08-16 14:40:35HanksburgerTwo Currencies (JOI23_currencies)C++17
100 / 100
592 ms54968 KiB
#include <bits/stdc++.h>
using namespace std;
long long par[100005][20], edge[100005], depth[100005], in[100005], out[100005], l1[100005], r1[100005], l2[100005], r2[100005], x[100005], y[100005], ans[100005], bit[200005], bit2[200005], n, m, q, sz;
vector<pair<long long, long long> > adj[100005], upd;
void dfs(long long u, long long p)
{
par[u][0]=p;
for (long long i=1; i<20; i++)
par[u][i]=par[par[u][i-1]][i-1];
for (long long i=0; i<adj[u].size(); i++)
{
long long v=adj[u][i].first, w=adj[u][i].second;
if (v==p)
continue;
depth[v]=depth[u]+1;
edge[v]=w;
in[w]=(++sz);
dfs(v, u);
out[w]=(++sz);
}
}
void update(long long s, long long t)
{
for (long long i=s; i<=sz; i+=i&(-i))
{
bit[i]+=t;
if (t>0)
bit2[i]++;
else
bit2[i]--;
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

currencies.cpp: In function 'void dfs(long long int, long long int)':
currencies.cpp:10:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for (long long i=0; i<adj[u].size(); i++)
      |                         ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...