Submission #673025

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6730252022-12-19 12:19:46JooDdaeBridges (APIO19_bridges)C++17
59 / 100
3083 ms4844 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n, m, q, p[50050], sz[50050], ans[100100];
bool chk[100100], chk2[100100];
stack<array<int, 2>> st;
int find(int a) {
if(a == p[a]) return a;
return find(p[a]);
}
bool merge(int a, int b) {
// cout << a << "+" << b << "\n";
a = find(a), b = find(b);
if(a == b) return false;
if(sz[a] < sz[b]) swap(a, b);
p[b] = a, sz[a] += sz[b];
st.push({a, b});
return true;
}
int main(){
cin.tie(0)->sync_with_stdio(0);
cin >> n >> m;
vector<array<int, 3>> E(m);
for(auto &[z, x, y] : E) cin >> x >> y >> z;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

bridges.cpp: In function 'int main()':
bridges.cpp:56:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |             while(j < e.size() && e[j][0] >= y) merge(e[j][1], e[j][2]), j++;
      |                   ~~^~~~~~~~~~
bridges.cpp:59:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |             while(r < v2.size() && v2[r][0] < i) r++;
      |                   ~~^~~~~~~~~~~
#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...