Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "bits/stdc++.h"
- using namespace std;
- int main () {
- ios::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- //~ set<int> st;
- //~ st.insert(10);
- //~ st.insert(20);
- //~ st.insert(30);
- //~ st.begin(),st.begin() + 1,st.begin() + 2, st.end()
- //~ for (auto x : st) {
- //~ cout << x << ' ';
- //~ }
- //~ cout << '\n';
- //~ st.erase(21);
- //~ for (auto x : st) {
- //~ cout << x << ' ';
- //~ }
- //~ cout << '\n';
- //~ auto it = st.find(20);
- //~ if (it == st.end()) {
- //~ //amra khuje painai
- //~ } else {
- //~ //amra paisi
- //~ }
- //0(n^2) => 100^2 => 1000
- //O(n * n - 1)
- //~ int n;
- //~ cin >> n;
- //~ vector<string> a;
- //~ for (int i = 0; i < n; ++i) {
- //~ string s;
- //~ cin >> s;
- //~ bool f = false;
- //~ //0 + 1 + 2 + 3 + 4 + 5......
- //~ //n => 0 + 1 + 2 + 3 + 4....n - 1 = n * (n - 1)
- //~ for (int j = 0; j < (int) a.size(); ++j) {
- //~ if (s == a[j]) {
- //~ f = true;
- //~ break;
- //~ }
- //~ }
- //~ a.push_back(s);
- //~ if (f == true) {
- //~ cout << "YES\n";
- //~ } else {
- //~ cout << "NO\n";
- //~ }
- //~ }
- //~ set<string> st;
- //~ int n;
- //~ cin >> n;
- //~ for (int i = 0; i < n; ++i) {
- //~ string s;
- //~ cin >> s;
- //~ if (st.find(s) == st.end()) {
- //~ //painai
- //~ cout << "NO\n";
- //~ } else {
- //~ //paisi
- //~ cout << "YES\n";
- //~ }
- //~ st.insert(s);
- //~ }
- //~ set<int> st;
- //~ int n;
- //~ cin >> n;
- //~ for (int i = 0; i < n - 1; ++i) {
- //~ int x;
- //~ cin >> x;
- //~ st.insert(x);
- //~ }
- //~ for (int i = 1; i <= n; ++i) {
- //~ if (st.find(i) == st.end()) {
- //~ cout << i << '\n';
- //~ return 0;
- //~ }
- //~ }
- //upper_bound,lower_bound
- //~ set<int> st;
- //~ st.insert(10);
- //~ st.insert(20);
- //~ st.insert(30);
- //~ int x = 10;
- //~ auto it = st.upper_bound(x); //20
- //~ auto it2 = st.lower_bound(x); //10
- //~ cout << *it << '\n';
- //~ cout << *it2 << '\n';
- //~ multiset<int> st;
- //~ st.insert(20);
- //~ st.insert(10);
- //~ st.insert(10);
- //~ st.insert(10);
- //~ for (auto x : st) {
- //~ cout << x << ' ';
- //~ }
- //~ int x = 10;
- //~ cout << st.count(x); //x koto bar ache st er moddhe
- vector<int> a = {1,2,3,1,2,1,2,1,3,1,4,5};
- int count[6];
- for (int i = 0; i < 6; ++i) {
- count[i] = 0;
- }
- //count[1] = 0 + 1 + 1, count[2] = 0 + 1,count[3] = 0 + 1,count[4] = 0,count[5] = 0
- for (auto x : a) {
- count[x]++;
- }
- cout << count[3] << '\n';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement