版本比较
find cheat
正文
增加 66 行删除 15 行
12345678591011121376 行未改动90919293909495969798991001011021039910410510110610710810410911011111211332 行未改动14614714814915015115215315415515615715815916016116216315016416516616716816917017117215817317417517617712 行未改动1901911921931941791951961811971831841981992002012022031872042052062072087 行未改动21621721821920322022122222322417 行未改动2422432442452292462472482322492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912 行未改动请在发工单时加入如下内容:```markdown使用 [工具](https://www.luogu.com.cn/article/92py95rq) 辅助检查,均经过人工复核。``````js// ==UserScript==// @name Luogu Find Cheater// @namespace https://www.luogu.com.cn/user/841039// @version 2026-1-21// @version 2026-2-9// @author wanganze// @description luogu helper// @icon https://fecdn.luogu.com.cn/favicon.ico// @match *://*.luogu.com.cn/*76 行未改动 }); return data; } catch (error) { console.error('Error geting context:', error); console.log("error on",location.pathname); console.log("error on",url); return; }}unsafeWindow.get_context = get_context;function get_code(markdown){ let codes = []; let lst = 0,flag = 0; let mkd = markdown + '```'; while(markdown.indexOf("```",lst) != -1) while(mkd.indexOf("```",lst) != -1) { let cur = markdown.indexOf("```",lst); let cur = mkd.indexOf("```",lst); if(flag) { let res = markdown.slice(lst + 3,cur - 1); let res = mkd.slice(mkd.indexOf("\n",lst),cur - 1); codes.push(res) } lst = cur + 3; flag ^= 1;32 行未改动 tmp += code[i]; } } let lines = tmp.split(/\r?\n/); let reallines = []; let t = 0; for(let s of lines) { if(t) reallines.push(s); else reallines[reallines.length - 1] += s; if(s[s.length - 1] == '\\') t = 1; else t = 0; } let res = ""; for(let s of lines) { //console.log(s); if(s.search("#") != -1) continue; if(s.search("//") != -1) s = s.substring(s.search("//") - 1); if(s.search("//") != -1) s = s.substring(0,Math.max(0,s.search("//") - 1)); for(let x of s) { if(x > ' ' && x != '{' && x != '}' && x !=';' && x !=',') res += x; } } return res;}unsafeWindow.change = change;function levenshtein(a, b) {async function levenshtein(a, b) { const matrix = []; let i, j; for (i = 0; i <= b.length; i++) { matrix[i] = [i];12 行未改动 } return matrix[b.length][a.length];}unsafeWindow.cmp = similar;let dis;function similar(code,std)async function similar(code,std){ console.log(code.length,std.length); let lim = Math.min(200,0.1 * Math.max(code.length,std.length)); let code1 = change(code); let std1 = change(std); let code1 = await change(code); let std1 = await change(std); //console.log("len",code.length,std.length); if(Math.abs(code1.length - std1.length) > lim) return; //console.log(code1); //console.log(std1); let dis = levenshtein(code1,std1); dis = await levenshtein(code1,std1); console.log(dis,lim); if(dis <= lim) return 1; return 0;}7 行未改动 { let res = (await get_context("https://www.luogu.com.cn/problem/solution/" + pid + "/?page=" + page)).data; for(let k of res.solutions.result) { let codes = get_code(k.content); let codes = await get_code(k.content); allcodes.push({lid:k.lid,codes:codes}); //console.log(codes); } /*17 行未改动 { let flag = 0; for(let y of x.codes) { if(similar(code,y)) if((await similar(code,y)) == 1) { flag = 1; console.log(pid,x.lid); console.log(code,y); console.log(dis); console.log(pid,"https://www.luogu.com.cn/article/"+x.lid,location.href); } } }}unsafeWindow.find = get_userasync function get_user(l,r){ if(l == null && r == null) { let intro = (await get_context(location.href)); if(intro == null) return; let list = intro.data.dailyCounts; console.log(list); for(let x in list) { if(list.hasOwnProperty(x)) { if(list[x][0]>30 && list[x][1] > 2) alert(' '+x + ' ' + list[x]); } } } for(let i = l; i <= r; i ++) { let intro = (await get_context("https://www.luogu.com.cn/user/"+i)); if(intro == null) continue; let list = intro.data.dailyCounts; console.log(list); for(let x in list) { if(list.hasOwnProperty(x)) { if(list[x][0]>30 && list[x][1] > 2) alert(i+' '+x + ' ' + list[x]); } } }}(function() { 'use strict';
//getsolutions("P1001");2 行未改动