20230424小记

Posted 洛浔的小窝喵

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了20230424小记相关的知识,希望对你有一定的参考价值。

闲话

今天还是体育的一天
明天就要送别可爱同桌了
呜呜呜呜呜呜呜呜呜呜呜呜
她去济南了呜呜呜呜呜呜呜呜呜呜呜呜

冰糖老婆的精神状态好像不太正常
哭唧唧

调代码需要的信息提取能力也太高了()

听中 V 调代码效率↓/cf

调了昨天的题,复习了平衡树,然后调了一年。
第二天的升旗仪式上想出来的...

// Problem: P6136【模板】普通平衡树(数据加强版)
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P6136
// Memory Limit: 89 MB
// Time Limit: 3000 ms
#include<bits/stdc++.h>
using namespace std;
template<class T>void read(T &x)
    x=0;int f=0;char ch=getchar();
    while(ch<\'0\'||ch>\'9\')  f|=(ch==\'-\');ch=getchar();
    while(ch>=\'0\'&&ch<=\'9\')x=(x<<1)+(x<<3)+(ch^48);ch=getchar();
    x=f?-x:x;return;

const int N=1e5+5,M=1e6+5;
int n,m;
namespace FHQ_Treap
    int cnt,root;
    struct nodeint l,r,val,siz,key;a[N+M];
    int new_node(int val)
        a[++cnt]=(node)0,0,val,1,rand();return cnt;
    
    void pushup(int x)
        a[x].siz=a[a[x].r].siz+a[a[x].l].siz+1;
    
    void split(int k,int x,int &l,int &r)
        if(!k) l=r=0;return ;
        if(a[k].val<=x)l=k;split(a[k].r,x,a[k].r,r);
        else r=k;split(a[k].l,x,l,a[k].l);
        pushup(k);
    
    int merge(int l,int r)
        if(!l||!r)
            return (l+r);
        
        if(a[l].key<=a[r].key)
            a[l].r=merge(a[l].r,r);
            pushup(l);return l;
        
        else 
            a[r].l=merge(l,a[r].l);
            pushup(r);return r;
        
    
    int kth(int x,int k)
        if(a[a[x].l].siz+1==k) return x;
        if(a[a[x].l].siz>=k) return kth(a[x].l,k);
        return kth(a[x].r,k-a[a[x].l].siz-1);
    

using namespace FHQ_Treap;

int main()
    mt19937 srand(114514111);
    read(n),read(m);
    for(int i=1;i<=n;i++)
        int t,r1,r2;
        read(t);
        split(root,t,r1,r2);
        int tmp=new_node(t);
        root=merge(merge(r1,tmp),r2);
    
    int lastans=0,sumans=0;
    while(m--)
        int op,x;
        read(op),read(x);x^=lastans;
        if(op==1)
            int r1,r2;
            split(root,x,r1,r2);
            int tmp=new_node(x);
            root=merge(merge(r1,tmp),r2);
        
        if(op==2)
            int r1,r2,r3;
            split(root,x,r1,r2);
            split(r1,x-1,r1,r3);
            root=merge(merge(r1,merge(a[r3].l,a[r3].r)),r2);
        
        if(op==3)
            int r1,r2;
            split(root,x-1,r1,r2);
            lastans=a[r1].siz+1;
            sumans^=lastans;
            root=merge(r1,r2);
        
        if(op==4)
            lastans=a[kth(root,x)].val;
            sumans^=lastans;
        
        if(op==5)
            int r1,r2;
            split(root,x-1,r1,r2);
            lastans=a[kth(r1,a[r1].siz)].val;
            root=merge(r1,r2);
            sumans^=lastans;
        
        if(op==6)
            int r1,r2;
            split(root,x,r1,r2);
            lastans=a[kth(r2,1)].val;
            root=merge(r1,r2);
            sumans^=lastans;
        
    
    cout<<sumans<<endl;
    return 0;


vim使用小记

vim使用小记

语法高亮: https://blog.csdn.net/g_brightboy/article/details/14229139

个人代码

" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
" the call to :runtime you can find below.  If you wish to change any of those
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
" will be overwritten everytime an upgrade of the vim packages is performed.
" It is recommended to make changes after sourcing debian.vim since it alters
" the value of the ‘compatible‘ option.

" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim

" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets ‘nocompatible‘.  Setting ‘compatible‘ changes numerous
" options, so any other options should be set AFTER setting ‘compatible‘.
"set compatible

" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
if has("syntax")
	syntax on
endif

" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"set background=dark

" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
"  au BufReadPost * if line("‘"") > 1 && line("‘"") <= line("$") | exe "normal! g‘"" | endif
"endif

" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
"  filetype plugin indent on
"endif

" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd		" Show (partial) command in status line.
"set showmatch		" Show matching brackets.
"set ignorecase		" Do case insensitive matching
"set smartcase		" Do smart case matching
"set incsearch		" Incremental search
"set autowrite		" Automatically save before commands like :next and :make
"set hidden		" Hide buffers when they are abandoned
"set mouse=a		" Enable mouse usage (all modes)

" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif

syntax on

set showcmd

set t_Co=256


"使用配色方案
colorscheme elflord

"打开文件类型检测功能
filetype on

"不同文件类型采用不同缩进
filetype indent on

"允许使用插件
filetype plugin on
filetype plugin indent on

"关闭vi模式
set nocp

"与windows共享剪贴板
set clipboard+=unnamed

"取消VI兼容,VI键盘模式不易用
set nocompatible

"显示行号, 或set number
set nu

"历史命令保存行数 
set history=100 

"当文件被外部改变时自动读取
set autoread 

"取消自动备份及产生swp文件
set nobackup
set nowb
set noswapfile

"允许使用鼠标点击定位
set mouse=a

"允许区域选择
set selection=exclusive
set selectmode=mouse,key

"高亮光标所在行
set cursorline

"取消光标闪烁
set novisualbell

"总是显示状态行
set laststatus=2

"状态栏显示当前执行的命令
set showcmd

"标尺功能,显示当前光标所在行列号
"set ruler

"设置命令行高度为3
set cmdheight=3

"粘贴时保持格式
set paste

"高亮显示匹配的括号
set showmatch

"在搜索的时候忽略大小写
set ignorecase
 
"高亮被搜索的句子
set hlsearch
 
"在搜索时,输入的词句的逐字符高亮(类似firefox的搜索)
set incsearch

"继承前一行的缩进方式,特别适用于多行注释
set autoindent

"为C程序提供自动缩进
set smartindent

"使用C样式的缩进
set cindent

"制表符为4
set tabstop=4

"统一缩进为4
set softtabstop=4
set shiftwidth=4

"允许使用退格键,或set backspace=2
set backspace=eol,start,indent
set whichwrap+=<,>,h,l

"取消换行
set nowrap

"启动的时候不显示那个援助索马里儿童的提示
set shortmess=atI

"在被分割的窗口间显示空白,便于阅读
set fillchars=vert: ,stl: ,stlnc:
"光标移动到buffer的顶部和底部时保持3行距离, 或set so=3
set scrolloff=3

"设定默认解码
set fenc=utf-8
set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936

"设定字体
set guifont=Courier_New:h11:cANSI
set guifontwide=新宋体:h11:cGB2312
 
"设定编码
set enc=utf-8
set fileencodings=ucs-bom,utf-8,chinese
set langmenu=zh_CN.UTF-8
language message zh_CN.UTF-8
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim

"自动补全
filetype plugin indent on
set completeopt=longest,menu

"自动补全命令时候使用菜单式匹配列表
set wildmenu
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType java set omnifunc=javacomplete#Complet

function AddTitle()
call setline(1,"/*************************************")
call append(1,"# Author: Hs-black")
call append(2,"# Create Date: " . strftime("%Y-%m-%d"))
call append(3,"# Description: ")
call append(4,"**************************************/")
endf
map <F4> :call AddTitle()<cr>

filetype on
au BufEnter *.cpp nnoremap <F9> :w<cr>:!g++ % -std=c++11 -Wall -Wshadow -o %<
au BufEnter *.cpp nnoremap <c-F10> :!./%< < in.txt 

以上是关于20230424小记的主要内容,如果未能解决你的问题,请参考以下文章

iOS 开发小记

MySql 小记

博弈论小记

iOS 开发小记

Python学习小记

iOS 开发小记