U629171 10198 键盘paste
题目背景
电话:15989248601
```cpp
//重要提醒:作者应保证自身贡献不低于GenAI的贡献
//WS_EX_NOACTIVATE 不会夺取焦点 惊天发现
//重要提醒:作者应保证自身贡献不低于GenAI的贡献
//WS_EX_NOACTIVATE 不会夺取焦点 惊天发现
#include
#include
#define tab VK_TAB
#define space ' '
#define mouse_l VK_LBUTTON
#define mouse_r VK_RBUTTON
#define mouse_m VK_MBUTTON
#define shift VK_SHIFT
#define control VK_CONTROL
#define scstab SetConsoleTextAttribute
#define gsh GetStdHandle
#define soh STD_OUTPUT_HANDLE
#define fgis FOREGROUND_INTENSITY
#define lp key(mouse_l)
using namespace std;
queueq;
double s,maxc,cps,mode;
const string dc="cyan";
const string pc="violet";
bool ac,keyflag=1,changeac,cases[20];
int on=2,pf,cclear,sf;
POINT pos;
double clickspeed=10.0;
POINT curpos;
namespace std{ //所有常量
const int poss[][5]={{11,45,14},
{60,75,129,127},{130,75,182,127},{183,75,240,127},{241,75,297,127},
{298,75,353,127},{354,75,410,127},{60,140,145,190},{146,140,202,190},
{203,140,258,190},{259,140,314,190},{315,140,370,190},{60,200,123,255},
{124,200,415,255}
};
const int keycol[114]={0,6,15,22,29,36,43,6,17,24,31,38,6,14,58,62,64};
const int keyrow[514]={0,2,2,2,2,2,2,6,6,6,6,6,10,10,6,6,6};
const string printid[114]={"L","tab","q","w","e","t","p","shift","a","s","d","c","ctrl","space"};
const int mouses[514]={mouse_l,mouse_m,mouse_r};
const mapm={
{"tab",VK_TAB},{"q",'Q'},{"w",'W'},{"e",'E'},{"t",'T'},{"p",'P'},
{"a",'A'},{"shift",VK_SHIFT},{"s",'S'},{"d",'D'},{"c",'C'},
{"ctrl",VK_CONTROL},{"space",VK_SPACE}
};
const string mouseimage[50]={
"___________",
"| | | |",
"| | | |",
"| | | |",
"| |_| |",
"| |",
"| CPS |",
"| |",
"|_________|"
};
const string image[][5]={{},
{"_________","| |","| TAB |","|_______|"}, //1
{"_______","| |","| Q |","|_____|"}, //2
{"_______","| |","| W |","|_____|"}, //3
{"_______","| |","| E |","|_____|"}, //4
{"_______","| |","| T |","|_____|"}, //5
{"_______","| |","| P |","|_____|"}, //6
{"___________","| |", //7
"| SHIFT |","|_________|"},
{"_______","| |","| A |","|_____|"}, //8
{"_______","| |","| S |","|_____|"}, //9
{"_______","| |","| D |","|_____|"}, //10
{"_______","| |","| C |","|_____|"}, //11
{"________","| |","| CTRL |","|______|"}, //12
{"_____________________________________", //13
"| |",
"| SPACE |",
"|___________________________________|"},
{" "," "," "," "},{" "," "," ","_"},{" "," "," "," "}
};
const string acimage[]={" Autoclick:Left "," Autoclick:Right ",
" Autoclick:Close ","Autoclick:L-rand","Autoclick:R-rand"};
};
bool key(int i){
return GetAsyncKeyState(i)&0x8000;
}
void scroll_ing(bool f){//1是上,2是下
if(!key(shift)) return;
if(f) clickspeed*=1.067;
else clickspeed/=1.067;
if(clickspeed>500) clickspeed=500;
if(clickspeed= 0 && wParam==WM_MOUSEWHEEL) {
short delta = GET_WHEEL_DELTA_WPARAM(((MSLLHOOKSTRUCT*)lParam)->mouseData);
scroll_ing(delta>0);
}
return CallNextHookEx(NULL, nCode, wParam, lParam);
}, NULL, 0);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
UnhookWindowsHookEx(hook);
}
POINT getpos(){//获取鼠标位置
HWND hwnd = GetConsoleWindow();
SetWindowLongPtr(hwnd, GWL_EXSTYLE,
GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_NOACTIVATE);
HWND consoleHWND = GetConsoleWindow();
RECT rect;
POINT ret;
if (GetWindowRect(consoleHWND, &rect)) {
ret.x=rect.left;
ret.y=rect.top;
curpos.x=rect.left;
curpos.y=rect.top;
}
return ret;
}
void presskey(int keyCode) { //按下某个按键并松开
keybd_event(keyCode, 0, 0, 0);
keybd_event(keyCode, 0, KEYEVENTF_KEYUP, 0);
}
void go(int col,int line){//光标去到某位置
COORD p;
p.X=col;
p.Y=line;
SetConsoleCursorPosition(GetStdHandle(soh),p);
}
void color(int in_front_of,int behind=0){//调整颜色
//0 = 黑色 2 = 绿色 14 = 淡黄色 15 = 亮白色
WORD wColor=((behind&0x0F)
题目描述
```
#include
using namespace std;
const int maxn=100005;
int l[maxn],r[maxn],d[maxn],val[maxn],fa[maxn],del[maxn];
int find(int x){
if(fa[x]!=x) fa[x]=find(fa[x]);
return fa[x];
}
int merge(int x,int y){
if(!x||!y) return x+y;
if(val[x]>val[y]||(val[x]==val[y]&&x>y)) swap(x,y);
r[x]=merge(r[x],y);
fa[r[x]]=x;
if(d[l[x]]>n>>m;
for(int i=1;i>val[i];
l[i]=r[i]=d[i]=0;
fa[i]=i;
del[i]=0;
}
d[0]=-1;
while(m--){
int op;cin>>op;
if(op==1){
int x,y;
cin>>x>>y;
if(del[x]||del[y]) continue;
x=find(x);y=find(y);
if(x!=y) merge(x,y);
}
else{
int x;cin>>x;
if(del[x]){
cout
输入格式
无
输出格式
无