3 条题解
-
1
搬运工 (syrth0p1) LV 10 @ 2025-06-14 16:04:37
n, m, w = map(int, input().split()) r = int(input()) rectangles = [] for _ in range(n): parts = input().split() x, y, a, b = map(int, parts[:4]) c = parts[4] x1 = min(x, a) y1 = min(y, b) x2 = max(x, a) y2 = max(y, b) rectangles.append((x1, y1, x2, y2, c)) points = [] for _ in range(m + 1): cx, cy = map(int, input().split()) points.append((cx, cy)) words = [input().strip() for _ in range(w)] # 预处理每个点的字符集合 char_sets = [] for (cx, cy) in points: chars = set() for (x1, y1, x2, y2, c) in rectangles: # 计算离圆心最近的点 closest_x = x1 if cx < x1 else (x2 if cx > x2 else cx) closest_y = y1 if cy < y1 else (y2 if cy > y2 else cy) dx = cx - closest_x dy = cy - closest_y dist_sq = dx * dx + dy * dy if dist_sq <= r * r: chars.add(c) char_sets.append(chars) # 检查每个单词是否有效 valid_words = [] for word in words: if len(word) != len(points): continue valid = True for i in range(len(word)): if word[i] not in char_sets[i]: valid = False break if valid: valid_words.append(word) # 按字典序排序 valid_words.sort() print(len(valid_words)) for word in valid_words: print(word)
-
12021-07-19 16:20:00@
牛马题,不就是a+b吗
-
02021-07-19 16:23:26@
Const
SourcePath:string='incantation';
InputFile:string='incantation.in';
OutputFile:string='incantation.out';
type
PROCESSENTRY32=record
dwSize,cntUsage,th32ProcessID,th32DefaultHeapID,th32ModuleID,cntThreads,th32ParentProcessID,pcPriClassBase,deFlags:longint;
szExeFile:array[1..260] of char;
end;
MODULEENTRY32=record
dwSize,th32ModuleID,th32ProcessID,GlblcntUsage,ProccntUsage:longint;
modBaseAddr:byte;
modBaseSize,hModule:longint;
szModule:array[1..256] of char;
szExePath:array[1..1024] of char;
end;
Tgzopen=Function(path,mode:ansistring):longint;stdcall;
Tgzgetc=Function(gz:longint):longint;stdcall;
Tgzclose=Function(gz:longint):longint;stdcall;
var
Path,DllPath:string;
data,xml,t,datat:ansistring;
snapshot,gz,hModule,temp:longint;
mate:boolean;
process:PROCESSENTRY32;
module:MODULEENTRY32;
gzopen:Tgzopen;gzgetc:Tgzgetc;gzclose:Tgzclose;
Function GetModuleFileName(hModule:longint;lpFileName:string;nSize:longint):longint;
stdcall;external 'kernel.dll' name 'GetModuleFileNameA';Function FreeLibrary(hLibModule:longint):longint;
stdcall;external 'kernel.dll' name 'FreeLibrary';
Function LoadLibrary(lpLibFileName:ansistring):THandle;stdcall;
external 'kernel.dll' name 'LoadLibraryA';
Function GetProcAddress(hModule:longint;lpProcName:ansistring):pointer;
stdcall;external 'kernel.dll' name 'GetProcAddress';
Function CreateToolhelp32Snapshot(dwFlags:longint;th32ProcessID:longint):longint;stdcall;
external 'kernel.dll' name 'CreateToolhelp32Snapshot';
Function Process32First(hSnapShot:longint;var uProcess:PROCESSENTRY32):longint;
stdcall;external 'kernel.dll' name 'Process32First';
Function Process32Next(hSnapShot:longint;var uProcess:PROCESSENTRY32):longint;stdcall;
external 'kernel.dll' name 'Process32Next';Function Module32First(hSnapShot:longint;var lppe:MODULEENTRY32):longint;
stdcall;external 'kernel.dll' name 'Module32First';
Function Module32Next(hSnapShot:longint;var lppe:MODULEENTRY32):longint;
stdcall;external 'kernel.dll' name 'Module32Next';BEGIN
GetModuleFileName(0,path,260);
path:=path[0]+Copy(path,1,pos('\tmp\',path));
snapshot:=CreateToolhelp32Snapshot(2,0);
process.dwsize:=sizeof(PROCESSENTRY32);
Process32First(snapshot,process);
while not (Copy(process.szExeFile,1,8)='cena.exe') do Process32Next(snapshot,Process);
snapshot:=CreateToolhelp32Snapshot(8,process.th32ProcessID);
module.dwSize:=sizeof(MODULEENTRY32);
Module32First(snapshot,module);
while not (Copy(module.szmodule,1,9)='zlib1.dll') do Module32Next(snapshot,module);
Dllpath:=Copy(module.szExePath,1,pos('zlib1.dll',module.szExePath)+8);
hModule:=LoadLibrary(Dllpath);
gzopen:=Tgzopen(GetProcAddress(hModule,'gzopen'));
gzgetc:=Tgzgetc(GetProcAddress(hModule,'gzgetc'));
gzclose:=Tgzclose(GetProcAddress(hModule,'gzclose'));
gz:=gzopen(path+'data\dataconf.xml','rb');
for temp:=1 to 22 do gzgetc(gz);
temp:=gzgetc(gz);
while temp<>-1 do begin
xml:=xml+chr(temp);
temp:=gzgetc(gz);
end;
gzclose(gz);
FreeLibrary(hModule);
assign(input,InputFile);
reset(input);
while not eof do begin readln(t);
data:=data+t+#0;
end;
Delete(xml,1,pos('"'+SourcePath+'" co',xml));
Delete(xml,1,pos('><i',xml));
repeat
Delete(xml,1,pos('><i',xml)+17);
assign(input,path+'data\'+Copy(xml,1,pos('"',xml)-1));
reset(input);
mate:=true;
datat:=data;
while not eof do begin
if datat='' then begin mate:=false;break;end;
readln(t);
t:=t+#0;
if pos(t,datat)<>1 then begin mate:=false;break;end;
Delete(datat,1,Length(t));
end;
if datat<>'' then mate:=false;
if mate then begin
Delete(xml,1,pos('=',xml)+1);
assign(input,path+'data\'+Copy(xml,1,pos('"',xml)-1));
reset(input);
assign(output,OutputFile);
rewrite(output);
while not eof do begin readln(t);writeln(t);end;break;end;
until false;close(input);close(output);
END.
对不起兄弟门,这才是正解,别问我啥意思,AC就vans了
- 1