首页 > 其他分享 >cf tool 使用指南

cf tool 使用指南

时间:2023-08-18 22:12:35浏览次数:38  
标签:... exe file% script tool cf template 使用指南

本文作者使用 powershell 而非 cmd 。

本文作者使用 powershell 而非 cmd 。

本文作者使用 powershell 而非 cmd 。

下载

下载地址:https://github.com/woshiluo/cf-tool/releases/tag/v1.0.1

这不是 xalanq 的原版,原版有 bug。

对于 Windows 系统,请下载cf.exe

配置

开始

首先,将cf.exe放入一个加入系统 Path 的路径。

登录用户

Windows + R键打开 cmd,然后键入以下内容

cf config

会跳出来这个东西:

Configure the tool
0) login
1) add a template
2) delete a template
3) set default template
4) run "cf gen" after "cf parse"
5) set host domain
6) set proxy
7) set folders' name
Please choose one (index):

输入 0 就行了。

Configure handle/email and password
Note: The password is invisible, just type it correctly.
handle/email:

出现了这段内容,你只需要输入你的用户名和密码,密码是不显示的,只需要键入它就行了,然后你就会看见:

Succeed!!
Welcome hanyuchen2020~

(当然这不是我的号,但还是要膜拜hyc)

配置代码模板

再次键入

cf config

接下来键入 1。

Add a template
Language list:
   14: ActiveTcl 8.5
...
   20: Scala 2.12.8
   26: Secret_171
Select a language (e.g. "42"):

这一段又臭又长的东西,我们只需要键入 50(对于C++14)。

GNU G++14 6.4.0
Template:
  You can insert some placeholders into your template code. When generate a code from the
  template, cf will replace all placeholders by following rules:

  $%U%$   Handle (e.g. xalanq)
  $%Y%$   Year   (e.g. 2019)
  $%M%$   Month  (e.g. 04)
  $%D%$   Day    (e.g. 09)
  $%h%$   Hour   (e.g. 08)
  $%m%$   Minute (e.g. 05)
  $%s%$   Second (e.g. 00)
Template absolute path(e.g. "~/template/io.cpp"):

对于这一段,我们就需要键入自己代码模板的位置,比如D:\code\template.cpp

The suffix of template above will be added by default.
Other suffix? (e.g. "cxx cc"), empty is ok:

对于模板的后缀,直接键入cpp即可。

Template's alias (e.g. "cpp" "py"):

模板的名称,我们随便填一个,如C++ Template

Script in template:
Template will run 3 scripts in sequence when you run "cf test":
    - before_script   (execute once)
    - script          (execute the number of samples times)
    - after_script    (execute once)
  You could set "before_script" or "after_script" to empty string, meaning not executing.
  You have to run your program in "script" with standard input/output (no need to redirect).

  You can insert some placeholders in your scripts. When execute a script,
  cf will replace all placeholders by following rules:

  $%path%$   Path to source file (Excluding $%full%$, e.g. "/home/xalanq/")
  $%full%$   Full name of source file (e.g. "a.cpp")
  $%file%$   Name of source file (Excluding suffix, e.g. "a")
  $%rand%$   Random string with 8 character (including "a-z" "0-9")
Before script (e.g. "g++ $%full%$ -o $%file%$.exe -std=c++11"), empty is ok:

这又是一段又臭又长的东西,其实就是要你填编译指令,直接键入"g++ $%full%$ -o $%file%$.exe -std=c++14

Script (e.g. "./$%file%$.exe" "python3 $%full%$"):

这一段是运行指令,输入./$%file%$.exe

After script (e.g. "rm $%file%$.exe" or "cmd.exe /C del $%file%$.exe" in windows), empty is ok:

这一段是删除可执行文件,我没有填,如果有需要可以填rm $%file%$.exe

Make it default (y/n)?

是否要将它设为默认?填y就行了。

设置文件夹名称

继续输入

cf config

这次我们输入 7。

Set folders' name
Enter empty line if you don't want to change the value
Root path (current: cf)
> codeforces
contest path (current: contest)
> contest
gym path (current: gym)
> gym
group path (current: group)
> group
acmsguru path (current: acmsguru)
> acmsguru

完成。

接下来你如果在D:\这个位置输入cf race 1,那么文件就会保存在D:\codeforces\contest\1\中。

基本使用

打开比赛

我们可以用 cf tool 打开一场比赛。

如果这场比赛已经开始,那么他会直接跳出比赛页面并保存样例,比如in1.txtans3.txt

而没有开始的话,比如Codeforces Round (Div. 2) and Divide by Zero 2022这场比赛,我现在输入cf race 1731就会看见:

Race CONTEST 1731
Countdown:
121:56:41

{%note info%}
有时候距离比赛开始时间较长,countdown 会不稳定,最好一段时间手动退出并重新开启。

创建代码模板

假如你在打Codeforces Round #840 (Div. 2) and Enigma 2022 - Cybros LNMIIT这场比赛时,想要在 b 题的文件夹下创建一个代码模板,那该怎么做呢?

你只需要通过 powershell 进入当前目录,然后输入cf gen,这个文件夹下就会出现一个b.cpp了。

测试代码

我写好了代码,但是我不知道是对是错,what should I do?

你只需要输入cf test就可以了。

接下来,如果你的代码正确,你会看见

g++ b.cpp -o b.exe -std=c++14
Passed #1 ... 0.000s 2.910MB

提交代码

我写好了一道题,如何提交?

你只需要输入cf submit就可以了。

接下来你就会看到:

Submit CONTEST 1721, problem c
Current user: shuger
Submitted
     #: 186353883
  when: 2022-12-22 20:53
  prob: C - Min-Max Array Transformation
  lang: GNU C++14
status: Accepted
  time: 374 ms
memory: 3.03 MB

这个实在不好改,就用自己的

其它的

cf watch [all] [<specifier>...]
cf open [<specifier>...]
cf stand [<specifier>...]
cf sid [<specifier>...]
cf race [<specifier>...]
cf pull [ac] [<specifier>...]
cf clone [ac] [<handle>]
cf upgrade

这些对于大多数人来说,都不是什么常用的命令,就不一一解释了。

写在最后

我从 2021 年入坑 Codeforces 以来,已经参加了很多场比赛,目前 rating 已经超过了 1600,希望大家看到这篇文章后也可以开始使用 cf tool ,减少 Codeforces 比赛中不必要的麻烦,提高编程效率,早日获得理想的成绩。

标签:...,exe,file%,script,tool,cf,template,使用指南
From: https://www.cnblogs.com/monomial/p/17641720.html

相关文章

  • CF1806E 题解
    题目大意给你一棵树,然后定义一个函数$f(x,y)$,接下来给你$q$组询问\(x_{i},y_{i}\),让你求每一次的$f(x_{i},y_{i})$。分析首先我们尝试根据这个函数的定义暴力求值,代码实现如下。llBFquery(intg,inth){if(!g)return0;return1ll*a[g]*a[h]+BFquery(p......
  • 现代CSS布局技术:Flexbox和Grid的使用指南和最佳实践
    在现代Web开发中,CSS布局技术变得越来越重要。Flexbox和Grid是两种常用的CSS布局技术,它们可以帮助我们创建灵活、可维护的布局。Flexbox布局Flexbox是一种基于弹性盒子模型的布局技术,它可以让我们更加容易地创建水平或垂直方向上的布局。以下是Flexbox的常见属性:容器属性disp......
  • CF1575G GCD Festival 题解
    题意给定一个长度为\(n\)的正整数数列\(a\),求\[\sum\limits_{i=1}^{n}\sum\limits_{j=1}^{n}\gcd\left(a_i,a_j\right)\times\gcd\left(i,j\right)\](\(1\len,a_i\le10^5\))。题解根据欧拉函数的性质,可以得出\[n=\sum\limits_{d\midn}\varphi(d)\]该......
  • CFD特性FPmarkets澳福认为了解这11种足够
    CFD在交易中很重要,但CFD特性很多投资者不了解,FPmarkets澳福认为了解这11种足够了:投资者通过标的资产价格价值的变化获利,而不拥有标的资产。差价合约交易没有固定的到期日。与期货交易类似,差价合约交易也提供杠杆使用机会。差价合约被视为场外交易产品,不能在美国进行交易。灵活性:差......
  • 开源.NetCore通用工具库Xmtool使用连载 - 正则表达式篇
    【Github源码】《上一篇》详细介绍了Xmtool工具库中的日期时间类库,今天我们继续为大家介绍其中的正则表达式类库。在日常的软件开发过程中,每个人都会或多或少的遇到各种各样需要校验数据格式的需求,有些格式是和具体业务逻辑相关;而有些格式是业界标准,在任何系统和功能中都一致通用......
  • Microsoft Quantum Computing Fundamentals (MS QCF)​读书笔记
    1.学习目标准备开发环境,以便在Q#中编写量子程序。了解Q#程序的结构。使用量子比特和叠加来构建量子随机数生成器。了解Azure昆腾如何使你能够在量子硬件上运行程序。2.准备工作申请一个微软账号,会有500美金的免费额度用于创建工作区和量子使用费用。3.创建Azure量......
  • Dnslog回显使用指南
    一、命令执行场景Liunx/Unix/MacOS系统:curlhttp://ip.port.xxx.dnslog.org/`whoami`ping`whoami`.ip.port.xxx.dnslog.orgWindows系统:ping%USERNAME%.xxx.dnslog.org二、SQL注入场景SQLServer数据库:DECLARE@hostvarchar(1024);SELECT@host=(SELECTTOP1master.d......
  • CF 1860 VP
    A猜结论,谁都会!B简单数学,谁都会!C简单博弈,谁都会!D数据范围小,\(O(N^4)\)乘小常数可以过。\(00,10,01,11\)个数均知道。\(i\)是\(1\)导致\(01,11\)总和增加\(i\)。dp即可。E要么不传送。要么\(x\)到一个地方,传送到一个地方,再到\(y\)。预处理所有可能的......
  • Java 工具类库:Hutool使用说明
    Hutool是什么Hutool是一个Java工具包类库,它可以对文件、流、加密解密、转码、正则、线程、XML等JDK方法进行封装,组成各种Utils工具类。Hutool即是Hu(谐音“糊涂”)+tool,前者致敬作者“前任公司”,后者为工具之意,谐音“糊涂”,寓意追求“万事都作糊涂观,无所谓失,无所谓得”的......
  • 题解:【CF858E】 Tests Renumeration
    题目链接一点模拟下下火。首先一定不能覆盖的,只能一点一点挪。将已经在合法位置上的去掉,剩下的测试分为四类:不碍事的样例测试。不碍事的常规测试。占据了样例测试位置的常规测试。占据了常规测试位置的样例测试。将\(1\simn\)中还未使用的空闲位置记录下来,结论是只需......