Submission #367477

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3674772021-02-17 13:09:32Jarif_RahmanBridges (APIO19_bridges)C++17
13 / 100
3079 ms12216 KiB
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
struct dsu{
stack<tuple<int, int, int>> st;
int n;
vector<int> id;
vector<vector<int>> comp;
dsu(int nn){
n = nn;
for(int i = 0; i < n; i++) id.pb(i), comp.pb({i});
}
int unite(int a, int b){
a = id[a], b = id[b];
if(a == b) return 0;
if(comp[a].size() > comp[b].size()) swap(a, b);
st.push({a, b, (int)comp[a].size()});
while(!comp[a].empty()){
int x = comp[a].back(); comp[a].pop_back();
id[x] = b;
comp[b].pb(x);
}
return 1;
}
void rollback(){
auto [a, b, sz] = st.top(); st.pop();
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

bridges.cpp: In function 'int main()':
bridges.cpp:55:32: warning: comparison of integer expressions of different signedness: 'std::vector<std::tuple<long long int, int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   55 |         if(query.back().size() >= sq) query.pb({});
      |            ~~~~~~~~~~~~~~~~~~~~^~~~~
#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...