diff --git a/a.cpp b/a.cpp index c97653d..27251be 100644 --- a/a.cpp +++ b/a.cpp @@ -5,5 +5,11 @@ using namespace atcoder; int main() { - cout << "hello,world" << endl; + int a[10]; + for (int i = 0; i < 10; i++) + { + cin >> a[i]; + } + + cout << a[a[a[0]]] << endl; } diff --git a/b.cpp b/b.cpp index c97653d..2e5fb13 100644 --- a/b.cpp +++ b/b.cpp @@ -5,5 +5,27 @@ using namespace atcoder; int main() { - cout << "hello,world" << endl; + int n, m; + unordered_map a; + + cin >> n >> m; + for (int i = 0; i < n; i++) + { + uint tmp_a; + cin >> tmp_a; + a[tmp_a]++; + } + for (int i = 0; i < m; i++) + { + uint b; + cin >> b; + + if (a[b] == 0) + { + cout << "No" << endl; + return 0; + } + a[b]--; + } + cout << "Yes" << endl; } diff --git a/c.cpp b/c.cpp index c97653d..01509aa 100644 --- a/c.cpp +++ b/c.cpp @@ -5,5 +5,120 @@ using namespace atcoder; int main() { - cout << "hello,world" << endl; + int n; + vector> s; + + cin >> n; + for (int y = 0; y < n; y++) + { + vector sn; + string str_s; + cin >> str_s; + + for (int x = 0; x < n; x++) + { + sn.push_back(str_s[x] == '#'); + } + s.push_back(sn); + } + + for (int y = 0; y < n; y++) + { + int white_1 = -1, white_2 = -1, white_3 = -1; + for (int x = 0; x < n; x++) + { + if (s[y][x] == false) + { + white_3 = white_2; + white_2 = white_1; + white_1 = x; + } + + if (x - 5 > white_3) + { + cout << "Yes" << endl; + return 0; + } + } + } + + for (int x = 0; x < n; x++) + { + int white_1 = -1, white_2 = -1, white_3 = -1; + for (int y = 0; y < n; y++) + { + if (s[y][x] == false) + { + white_3 = white_2; + white_2 = white_1; + white_1 = y; + } + + if (y - 5 > white_3) + { + cout << "Yes" << endl; + return 0; + } + } + } + + for (int i = -n; i < n; i++) + { + int white_1 = -1, white_2 = -1, white_3 = -1; + for (int j = 0; j < n; j++) + { + if (i + j >= 0 && i + j < n) + { + if (s[i + j][j] == false) + { + white_3 = white_2; + white_2 = white_1; + white_1 = j; + } + + if (j - 5 > white_3) + { + cout << "Yes" << endl; + return 0; + } + } + else + { + white_3 = j; + white_2 = j; + white_1 = j; + } + } + } + + for (int i = -n; i < n; i++) + { + int white_1 = -1, white_2 = -1, white_3 = -1; + for (int j = 0; j < n; j++) + { + if (i + j >= 0 && i + j < n) + { + if (s[i + j][n - j - 1] == false) + { + white_3 = white_2; + white_2 = white_1; + white_1 = j; + } + + if (j - 5 > white_3) + { + cout << "Yes" << endl; + return 0; + } + } + else + { + white_3 = j; + white_2 = j; + white_1 = j; + } + } + } + + cout << "No" << endl; } diff --git a/d.cpp b/d.cpp index c97653d..3f56111 100644 --- a/d.cpp +++ b/d.cpp @@ -5,5 +5,52 @@ using namespace atcoder; int main() { - cout << "hello,world" << endl; + int q; + multiset a; + cin >> q; + + for (int i = 0; i < q; i++) + { + int type, x, k; + cin >> type >> x; + if (type != 1) + cin >> k; + + multiset::iterator iter; + switch (type) + { + case 1: + a.insert(x); + break; + + case 2: + iter = a.upper_bound(x); + for (int j = 0; j < k; j++) + { + if (iter == a.begin()) + goto dbreak; + *iter--; + } + cout << *iter << endl; + break; + + case 3: + iter = a.lower_bound(x); + if (iter == a.end()) + goto dbreak; + for (int j = 0; j < k - 1; j++) + { + *iter++; + if (iter == a.end()) + goto dbreak; + } + cout << *iter << endl; + break; + + dbreak: + default: + cout << -1 << endl; + break; + } + } }