Skip to content

Instantly share code, notes, and snippets.

Avatar

Safronov Aleksei yarrr-ru

View GitHub Profile
View neural_network_function_2d.matlab
x1=-1.0; x2=+1.0; y1=-1.5; y2=+4.5;
nx=7; ny=9;
step_x=(x2-x1)/(nx-1); step_y=(y2-y1)/(ny-1);
step_min = min(step_x,step_y);
[x,y]=meshgrid([x1:step_x:x2], [y1:step_y:y2]);
z= x.^3 + 5.*x.^2.*y + x - y.^3;
surf(x,y,z), title('PS. Press<enter>');
pause;
xx=reshape(x,1,nx*ny);
yy=reshape(y,1,nx*ny);
View neural_network_function.matlab
x1=-1.0; x2=+1.0; y1=-1.5; y2=+4.5; z1=-1.0; z2=+1.0;
nx=7; ny=9; nz=5;
step_x=(x2-x1)/(nx-1); step_y=(y2-y1)/(ny-1); step_z=(z2-z1)/(nz-1);
step_min = min([step_x step_y step_z]);
[x,y,z]=meshgrid([x1:step_x:x2], [y1:step_y:y2], [z1:step_z:z2]);
f= 4.*x+x.^2.*y-z.*y;
isosurface(x,y,z,f), title('PS. Press<enter>');
pause;
close;
@yarrr-ru
yarrr-ru / cf_marathon_r2.cpp
Created Jul 31, 2018
Codeforces Marathon Round 2 yarrr's final submit
View cf_marathon_r2.cpp
#pragma GCC optimize("Ofast,no-stack-protector,tree-vectorize")
#pragma GCC target("avx,sse4,tune=native")
#include <iostream>
#include <cassert>
#include <string>
#include <vector>
#include <array>
#include <numeric>
#include <algorithm>
@yarrr-ru
yarrr-ru / interstellar.cpp
Created Apr 15, 2016
Deadline24, Interstellar, 86.40
View interstellar.cpp
#include "game.h"
#include "geometry.h"
#include <queue>
#include <array>
#include <set>
#include <cstdlib>
constexpr size_t kNone = std::numeric_limits<size_t>::max();
constexpr double kEps = 1e-5;
constexpr size_t kProfitTurnsAfterReset = 10;