AtCoder quickly check fastest codes

Add buttons on My Submissions page to view the fastest C++ submissions of the problem you submitted.

  1. // ==UserScript==
  2. // @name AtCoder quickly check fastest codes
  3. // @namespace https://github.com/zica87/self-made-userscipts
  4. // @version 1.0
  5. // @description Add buttons on My Submissions page to view the fastest C++ submissions of the problem you submitted.
  6. // @author zica
  7. // @match https://atcoder.jp/contests/*/submissions/me*
  8. // @grant none
  9. // @license GPL-3.0
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. "use strict";
  14.  
  15. const rows = document.getElementsByTagName("tbody")[0].children;
  16. for (const row of rows) {
  17. const problem_title_cell = row.children[1];
  18. // https://atcoder.jp/contests/typical90/tasks/typical90_ax
  19. const problem_url = problem_title_cell.firstChild.href;
  20. const last_slash = problem_url.lastIndexOf("/");
  21. // typical90_ax
  22. const problem_code = problem_url.substring(last_slash + 1);
  23. const last2_slash = problem_url.lastIndexOf("/", last_slash - 1);
  24. // https://atcoder.jp/contests/typical90
  25. const prefix = problem_url.substring(0, last2_slash);
  26. const result_url = `${prefix}/submissions?f.LanguageName=C%2B%2B&f.Status=AC&f.Task=${problem_code}&orderBy=time_consumption`;
  27. const button = document.createElement("button");
  28. Object.assign(button, {
  29. textContent: "rankings",
  30. className: "btn label",
  31. onclick: () => {
  32. window.open(result_url, "_blank");
  33. },
  34. });
  35. button.style.cursor = "alias";
  36. // execution time cell
  37. row.children[7].append(button);
  38. }
  39. })();