Submission #29107013
Source Code Expand
#include <atcoder/all>
using namespace atcoder;
// using mint = modint998244353;
// using mint = modint1000000007;
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,k,n) for (int i = (k); i < (n); ++i)
using namespace std;
using ll = long long;
// using P = pair<ll,ll>;
using P = pair<int,int>;
using vint = vector<int>;
using vll = vector<ll>;
using vvint = vector<vector<int>>;
using vvll = vector<vector<ll>>;
// const ll INF = (ll)2e18+9;
const int INF = (int)2e9+7;
// const ll MOD = (ll)1e9+9;
template<typename T>
void chmin(T &a, T b) { a = min(a, b); }
template<typename T>
void chmax(T &a, T b) { a = max(a, b); }
template<typename T>
void print(vector<T> v) {
int n = v.size();
rep(i,n) {
if (i == 0) cout << v[i];
else cout << ' ' << v[i];
}
cout << endl;
}
void solve() {
int n, q;
cin >> n >> q;
dsu uf(n+1);
rep(i,q) {
int l, r;
cin >> l >> r;
uf.merge(l-1, r);
}
if (uf.same(0,n)) cout << "Yes" << endl;
else cout << "No" << endl;
}
int main() {
solve();
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | E - Range Sums |
| User | goropikari |
| Language | C++ (GCC 9.2.1) |
| Score | 500 |
| Code Size | 1249 Byte |
| Status | AC |
| Exec Time | 100 ms |
| Memory | 4088 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 500 / 500 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt, example2.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, example0.txt, example1.txt, example2.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 100 ms | 3948 KiB |
| 001.txt | AC | 2 ms | 3512 KiB |
| 002.txt | AC | 3 ms | 3928 KiB |
| 003.txt | AC | 2 ms | 3632 KiB |
| 004.txt | AC | 52 ms | 3728 KiB |
| 005.txt | AC | 55 ms | 3672 KiB |
| 006.txt | AC | 77 ms | 4000 KiB |
| 007.txt | AC | 71 ms | 3872 KiB |
| 008.txt | AC | 17 ms | 3592 KiB |
| 009.txt | AC | 19 ms | 3736 KiB |
| 010.txt | AC | 91 ms | 4028 KiB |
| 011.txt | AC | 91 ms | 4088 KiB |
| 012.txt | AC | 91 ms | 3960 KiB |
| 013.txt | AC | 90 ms | 4024 KiB |
| 014.txt | AC | 89 ms | 3920 KiB |
| 015.txt | AC | 91 ms | 3872 KiB |
| 016.txt | AC | 90 ms | 3936 KiB |
| 017.txt | AC | 91 ms | 4036 KiB |
| 018.txt | AC | 90 ms | 3932 KiB |
| 019.txt | AC | 90 ms | 3936 KiB |
| 020.txt | AC | 90 ms | 3916 KiB |
| 021.txt | AC | 93 ms | 3912 KiB |
| 022.txt | AC | 90 ms | 3932 KiB |
| 023.txt | AC | 89 ms | 4040 KiB |
| 024.txt | AC | 90 ms | 3960 KiB |
| 025.txt | AC | 2 ms | 3512 KiB |
| 026.txt | AC | 63 ms | 3536 KiB |
| 027.txt | AC | 62 ms | 3596 KiB |
| 028.txt | AC | 65 ms | 3568 KiB |
| example0.txt | AC | 2 ms | 3464 KiB |
| example1.txt | AC | 2 ms | 3456 KiB |
| example2.txt | AC | 2 ms | 3532 KiB |