This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef LOCAL111 | |
#define _GLIBCXX_DEBUG | |
#else | |
#define NDEBUG | |
#endif | |
#define _USE_MATH_DEFINES | |
#include <bits/stdc++.h> | |
const int INF = 1e9; | |
using namespace std; | |
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use std::ops::{Index, IndexMut}; | |
// use std::cmp::{Ordering, min, max}; | |
// use std::collections::{BinaryHeap, BTreeMap}; | |
// use std::collections::btree_map::Entry::{Occupied, Vacant}; | |
// use std::clone::Clone; | |
fn getline() -> String{ | |
let mut res = String::new(); | |
std::io::stdin().read_line(&mut res).ok(); | |
res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::ops::{Index, IndexMut}; | |
use std::cmp::{Ordering}; | |
use std::collections::BinaryHeap; | |
use std::cmp::{min, max}; | |
// use std::clone::Clone; | |
fn getline() -> String{ | |
let mut res = String::new(); | |
std::io::stdin().read_line(&mut res).ok(); | |
res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef LOCAL111 | |
#define _GLIBCXX_DEBUG | |
#else | |
#define NDEBUG | |
#endif | |
#define _USE_MATH_DEFINES | |
#include <bits/stdc++.h> | |
const int INF = 1e9; | |
using namespace std; | |
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
#define REP(i,n) for(int i=0;i<n;i++) | |
#define FOR(i,a,b) for(int i=a;i<b;i++) | |
#define INF 2000000000 | |
#define SZ(a) ((int)a.size()) | |
// #define DEBUG(x) cout << #x << ": " << (x) << endl | |
// template<typename T> | |
// void dpite(vector<T> v){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
#define REP(i,n) for(int i=0;i<n;i++) | |
#define FOR(i,a,b) for(int i=a;i<b;i++) | |
#define INF 2000000000 | |
// #define DEBUG(x) cout << #x << ": " << (x) << endl | |
// void dpite(vector<int> v){ | |
// REP(i,(int)v.size()) cout << v[i] << ' '; | |
// cout << endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
int main() { | |
int n,m; | |
while(cin >> n >> m and n != 0) { | |
vector<int> a(n); | |
for(int i = 0; i < n; ++i) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct UnionFind { | |
par: Vec<usize>, | |
rank: Vec<usize>, | |
} | |
impl UnionFind { | |
fn new(n: usize) -> UnionFind { | |
let mut vec = vec![0;n]; | |
for i in 0..n { | |
vec[i] = i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef LOCAL111 | |
#define _GLIBCXX_DEBUG | |
#else | |
#define NDEBUG | |
#endif | |
#define _USE_MATH_DEFINES | |
#include <bits/stdc++.h> | |
const int INF = 1e9; | |
using namespace std; | |
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef LOCAL111 | |
#define _GLIBCXX_DEBUG | |
#else | |
#define NDEBUG | |
#endif | |
#include <bits/stdc++.h> | |
const long long INF = 1e17; | |
using namespace std; | |
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; } |
NewerOlder