Giter Club home page Giter Club logo

algorithms-11's Introduction

Различные алгоритмы для личного пользования

for speed:

g++ a.cpp -o a -std=c++17 -Wshadow -Wall -O2 -Wno-unused-result

for test:

g++ a.cpp -o a -std=c++17 -Wshadow -Wall -g -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG

Comparsion of difficults

policy based data structures

#include <ext/pb_ds/assoc_container.hpp>
using ll = long long;
using namespace __gnu_pbds;
//less = set
typedef tree<ll,null_type,less<ll>, rb_tree_tag,
        tree_order_statistics_node_update> indexed_set;
//less_equal = multiset
typedef tree<ll,null_type,less_equal<ll>, rb_tree_tag,
        tree_order_statistics_node_update> indexed_multiset;

ll idx = s.order_of_key(key);
auto it = s.find_by_order(idx);
cout << idx << " " << *it << "\n";

standart template

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define vec vector
#define P pair
#define F first
#define S second
#define MAXX 1e15
#define MOD 1e9 + 7

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    ll t;
    cin >> t;
    while(t--) {
        
    }
    
    return 0;
}

freopen

freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);

количество единиц в двоичном представлении;

__builtin_popcount(x)

setprecision + fixed

double root = 1.4454568;
cout << fixed; // use fixed point format
cout << setprecision( 3 ) << root << endl;

setwidth

cout << setw( 10 ) << setfill( '*' ) << x << endl;

algorithms-11's People

Contributors

artdu avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.