Submission #991518

#TimeUsernameProblemLanguageResultExecution timeMemory
991518Nika533September (APIO24_september)C++17
0 / 100
1 ms2652 KiB
#pragma GCC diagnostic warning "-std=c++11" #include <bits/stdc++.h> #define pb push_back #define f first #define s second #define MOD 1000000007 #define flush fflush(stdout) #define all(x) (x).begin(),(x).end() #define allr(x) (x).rbegin(), (x).rend() #define pii pair<int,int> using namespace std; const int N=1e5+5; int T,k,sz[N],p[N]; vector<int> g[N]; void make_set(int v) { p[v]=v; sz[v]=1; } int find_set(int v) { if (p[v]==v) return v; return p[v]=find_set(p[v]); } void merge(int a, int b) { a=find_set(a); b=find_set(b); if (a==b) return; if (sz[a]<sz[b]) swap(a,b); sz[a]+=sz[b]; p[b]=a; } void add_edges(int v) { for (auto u:g[v]) merge(u,v); } int solve(int n, int m, vector<int> F,vector<vector<int>> S) { for (int i=0; i<n; i++) { make_set(i); g[i].clear(); } for (int i=1; i<n; i++) { g[i].pb(F[i]); g[F[i]].pb(i); } int ans=0; for (int i=n-2; i>=0; i--) { int x=S[0][i]; add_edges(x); if (sz[find_set(x)]==n-i) ans++; } return ans; }

Compilation message (stderr)

september.cpp:1:32: warning: '-std=c++11' is not an option that controls warnings [-Wpragmas]
    1 | #pragma GCC diagnostic warning "-std=c++11"
      |                                ^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...