Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
#include
#include
#include
using namespace std; using namespace std; vector
graph[2000]; int idx[2000]; struct node{ int a; int b; int distance; node(int _a, int _b, int _distance){ a = _a; b = _b; distance = _distance; } bool operator < (const node &tmp)const{ return distance < tmp.distance; } }; int find_root(int a){ while(idx[a]!=a){ idx[a]=idx[idx[a]]; a=idx[a]; } return a; } bool check(int a, int b){ if(find_root(a)!=find_root(b)){ return false; } else{ return true; } } void unite_two_elements(int a, int b){ int _a=find_root(a); int _b=find_root(b); if(check(a, b)==false){ idx[_a]=_b; } } int main() { for(int i=0; i<2000; i++){ idx[i]=i; } int n; cin>>n; vector
v; for(int i=0; i
>a; v.push_back(node(i, j, a)); } } sort(v.begin(), v.end()); for(int i=0; i
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)