Recent submission : 4/day .

新闻(23 级新生群号:64177596)

欢迎24级新生加入程序设计实验室-Ivan_Chien
欢迎24级新生加入ACM、了解ACM程序设计实验室。
C++ 标准现降到 C++17-Ivan_Chien
为提高代码编译速度,判题机所使用的 C++ 标准现从 C++20 降为了 C++17,即不再支持 constrained algorithms 和 ranges 库等,但仍支持结构化绑定、if 和 switch 的初始化语句等特性。
平台现启用 C11 和 C++20 标准-Ivan_Chien
都 2023 年了我不允许我们的平台还不支持 Modern C++
gcc 版本升级到了 13.0.1,C 语言使用 C11 标准编译,C++ 使用 C++20 标准编译。

比如给出 1178 题的 C++20 测试代码:

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
        int n;
        cin >> n;
        vector<int> v(n);
        for (int i = 0; i < n; ++i) cin >> v[i];
        ranges::sort(v);
        for (int i = 0; i < n; ++i)
                cout << v[i] << " \n"[i == n - 1];
        return 0;
}

开发请参考:Update gcc13, enable C11 and C++20 · lab530/AHUCM_OJ_ref@06cd003 (github.com)
平台现已支持 Rust 和 Haskell 提交-Ivan_Chien

使用部分:

我不能允许都 2022 年了我们的 OJ 还不支持 Rust。
rustc 版本 1.61.0(installed by apt),编译使用的指令为 rustc Main.rs,并使用 ./Main 运行。
ghc 版本 8.0.2(installed by apt),编译使用的指令为 ghc Main.hs,并使用 ./Main 运行。
运行比较耗内存,所以像 Java、Python 一样放宽了内存,但不放宽时间。

例子:

P1001 AC 的例子:
Rust:
#[allow(unused_must_use)]
fn main() {
    loop {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s);

        let mut two = s.split_whitespace().map(|s| s.parse::<i64>());
        match (two.next(), two.next()) {
            (Some(Ok(a)), Some(Ok(b))) => println!("{}", a + b),
            _ => { break; }
        }
    }
}
Haskell:
import System.IO (isEOF)

main :: IO()
main = do done <- isEOF
          if not done
            then do line <- getLine
                    let a = (read (takeWhile (/= ' ') line) :: Int)
                    let b = (read (drop 1 (dropWhile (/= ' ') line)) :: Int)
                    putStrLn (show (a+b)) 
                    main
            else return ()

开发部分:

HUSTOJ 源码添加 Rust 部分修改参考:https://github.com/lab530/AHUCM_OJ_ref/commit/5bbb63ba8a4
修改后需要重新 make judge_client,并且将新的 judge_client 拷贝到 /usr/bin 下。并修改 /home/judge/etc 下的 judge.conf 中的 OJ_LANG_SET,添加 21。而后重启 judged:
sudo pkill -9 judged
sudo judged
Haskell: https://github.com/lab530/AHUCM_OJ_ref/commit/dc3402c29