HydroOJ 从入门到入土(8)用validAs解决Remote Judge提交的语言问题(>=4.9.17)

发布时间 2023-12-19 01:14:26作者: Bowen404

没有 validAs 这个语法的话, 编译语言会一大堆, 而且远程评测域(Remote Judge / vjudge)和普通域之间的语言名称并不通用, 很是麻烦. 比如我之前想引用cf域(vjudge)的题, 需要引入一堆数字编号的语言, 直接污染了我设置的可提交语言, 于是直接怒删 cf 域 (

1. 语言设置

设置位置: 控制面板 - 系统设置 - 语言

以 c++14(O2) 为例, 系统没装任何插件的默认情况如下:

cc.cc14o2:
  compile: /usr/bin/g++ -Wall -std=c++14 -o foo foo.cc -lm -I/include
  code_file: foo.cc
  display: C++

装了一本通插件的话, 会显示:

cc.cc14o2:
  compile: /usr/bin/g++ -Wall -std=c++14 -o foo foo.cc -lm -I/include
  code_file: foo.cc
  display: C++
  validAs:
    ybtbas: cc

这个 validAs, 就是将此编译器配置映射到指定的Remote Judge, 格式是 rmj名: 语言名. 具体的语言名可以参考附表.

比如想设置一个主系统和一本通/cf/洛谷都能用而且都显示为 C++14 的编译器 (洛谷这里用了 NOI 指定版本), 可以使用如下配置:

cc.cc14:
  compile: /usr/bin/g++ -Wall -std=c++14 -o foo foo.cc -lm -I/include
  display: C++14
  validAs:
    ybtbas: cc.cc14
    codeforces: codeforces.50
    luogu: luogu.28

2. 注意事项

  • 不是每种语言都有对应
  • 选几个主要的写进去就好了, 很多小众的语言可以等有人要用了再加.
  • 如果需要特定版本的话, 需要注意远程 OJ 上的版本更新

3. 附语言&名称速查表

各个官方插件的对应语言名称, 根据官方各个插件整理, 如有更新, 以官方为准. (Vjudge 正确食用方法)

3.1 常用对应表

默认全称 设置名 codeforces_id luogu_id
Bash bash
C c codeforces.43 luogu.2
C++ cc codeforces.50 luogu.28o2
C++98 cc.cc98 luogu.3
C++98(O2) cc.cc98o2 luogu.3o2
C++11 cc.cc11 luogu.4
C++11(O2) cc.cc11o2 luogu.4o2
C++14 cc.cc14 codeforces.50 luogu.28
C++14(O2) cc.cc14o2 luogu.28o2
C++17 cc.cc17 codeforces.61 luogu.12
C++17(O2) cc.cc17o2 luogu.12o2
Pascal pas codeforces.4 luogu.1
Java java codeforces.60 luogu.8
Kotlin kt codeforces.88
Kotlin/JVM kt.jvm luogu.21
Python py codeforces.31 luogu.7
Python 2 py.py2 codeforces.7
Python 3 py.py3 codeforces.31 luogu.7
PyPy3 py.pypy3 codeforces.41 luogu.25
PHP php codeforces.6 luogu.16
Rust rs codeforces.49 luogu.15
Haskell hs codeforces.12 luogu.19
NodeJS js codeforces.55 luogu.9
Golang go codeforces.32 luogu.14
Ruby rb codeforces.67 luogu.13
C# cs codeforces.9 luogu.17

3.2 CodeForces速查表

cf域id 对应语言&版本(2023.12.18 更新)
codeforces.43 GNU GCC C11 5.1.0
codeforces.80 Clang++20 Diagnostics
codeforces.52 Clang++17 Diagnostics
codeforces.50 GNU G++14 6.4.0
codeforces.54 GNU G++17 7.3.0
codeforces.73 GNU G++20 11.2.0 (64 bit, winlibs)
codeforces.59 Microsoft Visual C++ 2017
codeforces.61 GNU G++17 9.2.0 (64 bit, msys 2)
codeforces.65 C# 8, .NET Core 3.1
codeforces.79 C# 10, .NET SDK 6.0
codeforces.9 C# Mono 6.8
codeforces.28 D DMD32 v2.105.0
codeforces.32 Go 1.19.5
codeforces.12 Haskell GHC 8.10.1
codeforces.60 Java 11.0.6
codeforces.74 Java 17 64bit
codeforces.87 Java 21 64bit
codeforces.36 Java 1.8.0_241
codeforces.77 Kotlin 1.6.10
codeforces.83 Kotlin 1.7.20
codeforces.88 Kotlin 1.9.21
codeforces.19 OCaml 4.02.1
codeforces.3 Delphi 7
codeforces.4 Free Pascal 3.2.2
codeforces.51 PascalABC.NET 3.8.3
codeforces.13 Perl 5.20.1
codeforces.6 PHP 8.1.7
codeforces.7 Python 2.7.18
codeforces.31 Python 3.8.10
codeforces.40 PyPy 2.7.13 (7.3.0)
codeforces.41 PyPy 3.6.9 (7.3.0)
codeforces.70 PyPy 3.9.10 (7.3.9, 64bit)
codeforces.67 Ruby 3.2.2
codeforces.75 Rust 1.72.0 (2021)
codeforces.20 Scala 2.12.8
codeforces.34 JavaScript V8 4.8.0
codeforces.55 Node.js 15.8.0 (64bit)
codeforces.75 Rust 1.72.0 (2021)
codeforces.20 Scala 2.12.8
codeforces.34 JavaScript V8 4.8.0
codeforces.55 Node.js 15.8.0 (64bit)

3.3 Luogu 速查表

luogu域id 对应语言&版本(2023.12.18 更新)
luogu.1 Free Pascal 3.2.0。
luogu.2 ISO C99 (GCC)
luogu.3 ISO C++98 (GCC)
luogu.4 ISO C++11 (GCC)
luogu.7 Python 3 (CPython)
luogu.8 Java 8
luogu.9 Node.js LTS
luogu.11 ISO C++14 (GCC)
luogu.12 ISO C++17 (GCC)
luogu.13 Ruby
luogu.14 Go
luogu.15 Rust nightly (rustc)
luogu.16 PHP
luogu.17 C# Mono
luogu.18 mono_vb(?)
luogu.19 Haskell (GHC)
luogu.21 Kotlin/JVM
luogu.22 Scala
luogu.23 Perl
luogu.25 Python 3 (PyPy)
luogu.27 ISO C++20 (GCC)
luogu.28 NOI C++14 GCC 9.3.0
luogu.29 fsharp(?)
luogu.30 Ocaml
luogu.31 Julia

3.4 POJ 速查表

poj域id 对应语言&版本(2023.12.18 更新)
poj.0 C++98, GCC 4.4.0
poj.1 C99, GCC 4.4.0
poj.2 Java, JDK 6
poj.3 FreePascal, 2.2.0
poj.4 C++98, MS VC++ 2008 Express
poj.5 C99, MS VC++ 2008 Express
poj.6 Fortran 95, GCC 4.4.0

3.5 UOJ 速查表

UOJ域id 对应语言&版本(2023.12.18 更新)
uoj.C++03 C++03
uoj.C++11 C++11
uoj.C++ C++14
uoj.C++17 C++17
uoj.C++20 C++20
uoj.C C
uoj.Python3 Python3
uoj.Python27 (没有点) Python2.7
uoj.Java8 Java8
uoj.Java11 Java11
uoj.Java17 Java17
uoj.Pascal Pascal

3.6 其他

一般可以通过查看提交语言列表的 optionvalue 来确定, 或者查看 provider 的源码映射.

注意语言版本, 可能会随时更新.