Submission #636612

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6366122022-08-29 16:57:43MohamedFaresNebiliBridges (APIO19_bridges)C++14
100 / 100
2193 ms31100 KiB
#include <bits/stdc++.h>
using namespace std;
const int batch = 1001;
int N, M, Q, ans[100001];;
int S[100001], P[100001];
int U[100001], V[100001], W[100001];
int T[100001], X[100001], Y[100001];
vector<int> join[batch]; stack<int> st;
bool changed[100001];
void reset() {
for(int i = 1; i <= N; i++)
P[i] = i, S[i] = 1;
}
int findSet(int a) {
if(P[a] == a) return a;
return findSet(P[a]);
}
void unionSet(int a, int b) {
a = findSet(a), b = findSet(b);
if(a == b) return;
if(S[a] > S[b]) swap(a, b);
st.push(a); S[b] += S[a];
P[a] = P[b];
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

bridges.cpp: In function 'void restore(int)':
bridges.cpp:33:33: warning: comparison of integer expressions of different signedness: 'std::stack<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |                 while(st.size() > x) {
      |                       ~~~~~~~~~~^~~
bridges.cpp: In function 'int32_t main()':
bridges.cpp:86:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   86 |                         while(cur < E.size() && W[E[cur]] >= Y[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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...