优化丑陋的代码

pull/7/head
undefined 4 years ago
parent 62ac2f52c9
commit dd1b7c363a

@ -22,7 +22,6 @@ module.exports = {
'no-underscore-dangle': 'off',
'no-restricted-syntax': 'off',
'max-classes-per-file': 'off',
radix: 'off',
'guard-for-in': 'off',
'no-param-reassign': 'off',
'global-require': 'off',

@ -1,5 +1,5 @@
FROM mhart/alpine-node:slim-10
WORKDIR /app
ADD .build /app
COPY .build /app
EXPOSE 8888
CMD ["node", ".build/development.js"]

@ -13,7 +13,7 @@ Hydro 的界面基于 Vijos 二次开发。
排名不分先后,按照链接字典序
- [Github](https://github.com/) 为 Hydro 提供了代码托管与自动构建。
- [criyle](https://github.com/criyle) 提供评测沙箱实现。
- [Vijos](https://github.com/vijos/vj4) 为 Hydro 提供了UI框架。
- [undefined](https://masnn.io:38443/) 项目主要开发人员。
- [Github](https://github.com/) 为 Hydro 提供了代码托管与自动构建。
- [criyle](https://github.com/criyle) 提供评测沙箱实现。
- [Vijos](https://github.com/vijos/vj4) 为 Hydro 提供了UI框架。
- [undefined](https://masnn.io:38443/) 项目主要开发人员。

@ -23,7 +23,7 @@ class RecordListHandler extends RecordHandler {
if (uidOrName) {
q.$or = [
{ unameLower: uidOrName.toLowerCase() },
{ _id: parseInt(uidOrName) },
{ _id: parseInt(uidOrName, 10) },
];
}
if (pid) q.pid = pid;

@ -54,6 +54,7 @@ class SystemSettingHandler extends SystemHandler {
const current = {};
const settings = setting.SYSTEM_SETTINGS;
for (const s of settings) {
// eslint-disable-next-line no-await-in-loop
current[s.key] = await system.get(s.key);
}
this.response.body = {

@ -39,7 +39,7 @@ async function _parseDagJson(domainId, dag) {
// eslint-disable-next-line no-await-in-loop
await Promise.all(tasks);
const newNode = {
_id: parseInt(node._id),
_id: parseInt(node._id, 10),
title: node.title,
requireNids: Array.from(new Set(node.requireNids)),
pids: Array.from(new Set(node.pids)),
@ -112,8 +112,9 @@ class TrainingDetailHandler extends TrainingHandler {
for (const pid in psdict) {
const psdoc = psdict[pid];
if (psdoc.status) {
if (psdoc.status === builtin.STATUS.STATUS_ACCEPTED) donePids.add(parseInt(pid));
else progPids.add(parseInt(pid));
if (psdoc.status === builtin.STATUS.STATUS_ACCEPTED) {
donePids.add(parseInt(pid, 10));
} else progPids.add(parseInt(pid, 10));
}
}
const nsdict = {};
@ -124,7 +125,7 @@ class TrainingDetailHandler extends TrainingHandler {
const totalCount = node.pids.length;
const doneCount = Set.union(new Set(node.pids), donePids).size;
const nsdoc = {
progress: totalCount ? parseInt(100 * (doneCount / totalCount)) : 100,
progress: totalCount ? parseInt(100 * (doneCount / totalCount), 10) : 100,
isDone: training.isDone(node, doneNids, donePids),
isProgress: training.isProgress(node, doneNids, donePids, progPids),
isOpen: training.isOpen(node, doneNids, donePids, progPids),

@ -156,7 +156,7 @@ class UserSearchHandler extends Handler {
let udocs;
if (exactMatch) udocs = [];
else udocs = await user.getPrefixList(q, 20);
const udoc = await user.getById(domainId, parseInt(q));
const udoc = await user.getById(domainId, parseInt(q, 10));
if (udoc) udocs.push(udoc);
for (const i in udocs) {
if (udocs[i].gravatar) {

@ -3,8 +3,8 @@ function decodeBase64WithUriEncoding(encodedText) {
}
function unescapedString(escapedString) {
escapedString += new Array(5 - escapedString.length % 4).join('=');
return escapedString.replace(/\-/g, '+').replace(/_/g, '/');
escapedString += new Array(5 - (escapedString.length % 4)).join('=');
return escapedString.replace(/-/g, '+').replace(/_/g, '/');
}
function decodeJWT(idToken) {

@ -62,7 +62,7 @@ function _digit2(number) {
}
function formatSeconds(seconds = 0) {
seconds = parseInt(seconds);
seconds = parseInt(seconds, 10);
return '{0}:{1}:{2}'.format(
_digit2(Math.floor(seconds / 3600)),
_digit2(Math.floor((seconds % 3600) / 60)),

@ -6,9 +6,9 @@ function convert(ini) {
const res = { cases: [] };
for (let i = 1; i <= count; i++) {
const [input, output, time, score, memory] = f[i].split('|');
const cur = { input, output, score: parseInt(score) };
const cur = { input, output, score: parseInt(score, 10) };
cur.time = `${time}s`;
if (!Number.isNaN(parseInt(memory))) cur.memory = `${Math.floor(parseInt(memory) / 1024)}m`;
if (!Number.isNaN(parseInt(memory, 10))) cur.memory = `${Math.floor(parseInt(memory, 10) / 1024)}m`;
else cur.memory = '128m';
res.cases.push(cur);
}

@ -83,8 +83,8 @@ global.Hydro.model.training = module.exports = {
if (!tdoc) throw new TrainingNotFoundError(tid);
for (const i in tdoc.dag) {
for (const j in tdoc.dag[i].pids) {
if (Number.isSafeInteger(parseInt(tdoc.dag[i].pids[j]))) {
tdoc.dag[i].pids[j] = parseInt(tdoc.dag[i].pids[j]);
if (Number.isSafeInteger(parseInt(tdoc.dag[i].pids[j], 10))) {
tdoc.dag[i].pids[j] = parseInt(tdoc.dag[i].pids[j], 10);
}
}
}

@ -20,7 +20,7 @@ async function run({ domainId, isSub = false }, report) {
memory_kb: 0,
score: 0,
},
progress: Math.floor(((parseInt(i) + 1) / domains.length) * 100),
progress: Math.floor(((parseInt(i, 10) + 1) / domains.length) * 100),
});
}
return true;
@ -44,7 +44,7 @@ async function run({ domainId, isSub = false }, report) {
udict[udoc.uid] = udoc.new;
}
if (!isSub) {
await report({ progress: Math.floor(((parseInt(i) + 1) / contests.length) * 100) });
await report({ progress: Math.floor(((parseInt(i, 10) + 1) / contests.length) * 100) });
}
await report({
case: {
@ -58,7 +58,7 @@ async function run({ domainId, isSub = false }, report) {
}
const tasks = [];
for (const uid in udict) {
tasks.push(user.setInDomain(domainId, parseInt(uid), { rating: udict[uid] }));
tasks.push(user.setInDomain(domainId, parseInt(uid, 10), { rating: udict[uid] }));
}
await Promise.all(tasks);
return true;

@ -5,7 +5,7 @@ async function run({
uname, password, mail, uid,
}) {
if (!uid) uid = await system.inc('user');
else uid = parseInt(uid);
else uid = parseInt(uid, 10);
if (Number.isNaN(uid)) throw new Error('uid');
await user.create({
uid, uname, password, mail, regip: '127.0.0.1',

@ -3,7 +3,7 @@ const user = require('../model/user');
async function run({
uid,
}) {
uid = parseInt(uid);
uid = parseInt(uid, 10);
if (Number.isNaN(uid)) throw new Error('uid');
await user.setSuperAdmin(uid);
return uid;

@ -63,15 +63,15 @@ const validate = {
tag: _splitAndTrim,
beginAtDate: _date,
beginAtTime: _time,
pid: (pid) => (Number.isSafeInteger(parseInt(pid)) ? parseInt(pid) : pid),
pid: (pid) => (Number.isSafeInteger(parseInt(pid, 10)) ? parseInt(pid, 10) : pid),
content: validator.checkContent,
title: validator.checkTitle,
uid: (uid) => parseInt(validator.checkUid(uid)),
uid: (uid) => parseInt(validator.checkUid(uid), 10),
password: validator.checkPassword,
mail: validator.checkEmail,
uname: validator.checkUname,
page: (page) => {
if (Number.isSafeInteger(parseInt(page))) page = parseInt(page);
if (Number.isSafeInteger(parseInt(page, 10))) page = parseInt(page, 10);
if (page <= 0) throw new ValidationError('page');
return page;
},
@ -83,7 +83,7 @@ const validate = {
pids: (pids) => {
const res = pids.split(',').map((i) => i.trim());
for (const i in res) {
if (Number.isSafeInteger(parseInt(res[i]))) res[i] = parseInt(res[i]);
if (Number.isSafeInteger(parseInt(res[i], 10))) res[i] = parseInt(res[i], 10);
}
return res;
},

@ -1,415 +1,3 @@
# Vijos UI Framework
## Responsive Cutoffs
Vijos use the following cutoffs to determine the size of a device.
Small: `[0 - 450px)` (mobile)
Medium: `[450px, 1000px)` (tablet)
Large: `[1000px, -)` (desktop)
## Layout
### Grid
See [Foundation Grid](http://foundation.zurb.com/sites/docs/grid.html)
### Float
See [Foundation Float](http://foundation.zurb.com/sites/docs/float-classes.html)
> NOTE: `.float-center` is not implemented.
## Typography
HTML elements such as headings (`h1`, `h2`, ...), lists (`ol`, `ul`, `li`, ...) and tables does not have margins and paddings by default in order to easy the styling of semantic structures. However you may want suitable space between those elements when they are used to present content to users (for example, problem content). In this case, you need to enable the typography styling by wrapping them with `<div class="typo"></div>`:
```html
<div class="typo">
<h1>Notice</h1>
<p>The content will be well formatted.</p>
<ul>
<li>Item</li>
<li>Item</li>
<li>Item</li>
</ul>
</div>
```
### Text Alignment
```html
<ANY class="text-left"></ANY>
<ANY class="text-center"></ANY>
<ANY class="text-right"></ANY>
<ANY class="text-justify"></ANY>
```
## Prototype Components
### Media Object
TODO
### Number Box Object
TODO
### Balancer Object
TODO
## Basic Components
### Section
Section is served as an entry to more detailed contents. By default, each section has a white background and drop-shadow.
A section should contain a section-header and one or more section bodies.
```html
<div class="section">
<div class="section__header">
<!-- header -->
</div>
<div class="section__body">
<!-- body -->
</div>
<div class="section__body">
<!-- optionally more bodies -->
</div>
</div>
```
There will be vertical margins between section bodies.
#### Side Section
If the section is acted as a sidebar section, it should contain `side` class so that its default font size becomes smaller:
```html
<div class="section side"></div>
```
#### Title
You can use `<X class="section__title"></X>` to specify the title for a section (`X` is from `h1` to `h3`). The font size and the color of the section title is different from normal headings.
```html
<div class="section">
<div class="section__header">
<h1 class="section__title">Section title</h1>
</div>
</div>
```
#### Table
If the main content of the section is a data table (or additionally with a title and a paginator), it is suggested to apply `data-table` to the table. Table should be put inside a section-body with `no-padding` decoration.
3 * 2 table sample:
```html
<div class="section">
<!-- ... -->
<div class="section__body no-padding">
<table class="data-table">
<colgroup>
<col class="col--1">
<col class="col--2">
</colgroup>
<thead>
<tr>
<th class="col--1"></th>
<th class="col--2"></th>
</tr>
</thead>
<tbody>
<tr><td class="col--1">1,1</td><td class="col--2">1,2</td></tr>
<tr><td class="col--1">2,1</td><td class="col--2">2,2</td></tr>
<tr><td class="col--1">3,1</td><td class="col--2">3,2</td></tr>
</tbody>
</table>
</div>
</div>
```
> If you want to specify the width of a column, you should add `col--xxx` to the class name list (as shown above) and specify its width in a CSS rule like:
>
> ```css
> .col--1 { width: 120px; }
> ```
#### Samples
Section with content:
```html
<div class="section">
<div class="section__body">
Section content
</div>
</div>
```
Section with title and content:
```html
<div class="section">
<div class="section__header">
<h1 class="section__title">Section title</h1>
</div>
<div class="section__body">
Section content
</div>
</div>
```
Section with title and table content:
```html
<div class="section">
<div class="section__header">
<h1 class="section__title">Section title</h1>
</div>
<div class="section__body no-padding">
<table class="data-table">
<!-- ... -->
</table>
</div>
</div>
```
### Button
```html
<ANY class="button"></ANY>
```
Additional class names:
`rounded`: The button would have round corners.
`primary`: The button would have blue background.
`expanded`: The button would occupy full width of the parent.
`inverse`: TODO
### Input
```html
<X class="textbox"></X>
```
`X` could be `input` or `textarea`.
Additional class names:
`material`: TODO
`inverse`: TODO
### Paginator
TODO
### Menu
```html
<ol class="menu">
<li class="menu__item">
<a href="#" class="menu__link">Item</a>
</li>
<li class="menu__seperator"></li>
</ol>
```
Optionally, a menu item can be `active` or `highlight` (notice that the decorator class name is added to `menu__link` instead of `menu__item`):
```html
<li class="menu__item">
<a href="#" class="menu__link active">Active Item</a>
</li>
<li class="menu__item">
<a href="#" class="menu__link highlight">Highlight Item</a>
</li>
```
Menu can be put inside a section. It should be placed inside `section__body no-padding` or directly inside `section`:
```html
<div class="section">
<div>
<ol class="menu">
...
</ol>
</div>
</div>
```
#### Menu Item from Headings
Menu items can be automatically generated from headings. To enable this feature, you need to specify the region to extract headings and the destination of extracted menu items by setting `data-heading-extract-to` attribute:
```html
<div class="section" data-heading-extract-to="#my-menu-item">
<h1 id="h_1" data-heading>Heading 1</h1>
<h1 id="h_2" data-heading>Heading 2</h1>
</div>
```
This attribute accepts a CSS selector and all elements that contain `data-heading` attribute in the element will be extracted. `id` is essential and it will be appended to the hash part so that the page will navigate when user clicks the newly generate menu item.
The CSS selector should match a `menu__item` element. Headings will become the sub-menu of that element.
### Sticky
Sticky elements are always visible when the user scrolls. To enable sticky, add `data-sticky` attribute to the element.
Optionally, the value of `data-sticky` can be `medium` or `large`. When `data-sticky` is `medium`, the element will be sticky only when window size is larger than mobile cutoff (can be tablet or desktop). When `data-sticky` is `large`, it will take effect only when window size is larger than desktop cutoff. See section Responsive Cutoffs for actual sizes.
The sticky element is restricted to the boundary of its closest parent. You can change this behavior by assigning attribute `data-sticky-parent` to the desired parent. `data-sticky-parent` can not be used in nested sticky elements.
A sample of sticky sidebar:
```html
<div class="row" data-sticky-parent>
<div class="medium-9 columns">
<!-- main content -->
</div>
<div class="medium-3 columns">
<div data-sticky="large">
<div class="section">Sticky!</div>
</div>
</div>
</div>
```
- Because the columns will be stacked when window size is smaller than `large` (tablet and mobile) and we don't want sidebars keep sticky in such cases, we have `data-sticky="large"` so that the element will be sticky ONLY when window size is `large`.
- The height of the two columns are not equal so the sticky parent should be `.row` instead.
### CommonMark Editor
CommonMark editor can be automatically transformed from a normal textarea. Inputs in the CommonMark editor will be synced to the textarea in real-time. To enable this feature, add `data-markdown` to the `textarea` element.
Sample:
```html
<textarea name="content" class="textbox" data-markdown></textarea>
```
> To make it work with newly added textareas, you need to trigger `vjContentNew` event for the new element. Textarea with `data-markdown` should be a children of the trigger target.
### Emoji
[Emoji code](http://www.webpagefx.com/tools/emoji-cheat-sheet/) can be automatically transformed into emoji images. To enable this feature, add `data-emoji-enabled` to the element.
Sample:
```html
<div class="typo" data-emoji-enabled></div>
```
> To make it work with newly added contents, you need to trigger `vjContentNew` event for the new element.
### Dropdown
TODO
### Navigation
TODO
### Star
TODO
### Tab
TODO
### Hotkey
#### Local Hotkey
Local hotkeys are triggered when it is assigned to a parent of the active element in which user presses specific key.
To enable local hotkey on an element, add `data-hotkey` attribute:
```html
<button data-hotkey="f1"></button>
```
You can specify multiple hotkeys in the attribute.
#### Global hotkey
Global hotkeys are triggered no matter where user presses specific key.
To enable global hotkey on an element, add `data-global-hotkey` attribute:
```html
<button data-global-hotkey="f2"></button>
```
You can specify multiple hotkeys in the attribute.
#### Hotkey Syntax
`hotKeyDef[,hotKeyDef[,hotKeyDef...]]`
`hotKeyDef`: `keySequence[:event]`
`keySequence`: `key1[+key2[+key3...]]`
When `keySequence` matches, the `event` will be triggered on the element that holds the attribute. If `event` is not given in `hotKeyDef`, it will be `click` by default. In addition, if `event` is `submit`, the event will be triggered on the closest `form` element, instead of the current element.
Sample:
`ctrl+f1`: Triggers click on this element when user presses `Ctrl`+`F1` or `Command`+`F1`.
`ctrl+enter:submit`: Triggers submit on the closest `form` when user presses `Ctrl+Enter` or `Command+Enter`.
`f1:submit,f2:client`: Triggers submit when user presses `f1` and triggers click when user presses `f2`.
### Tooltip
```html
<X data-tooltip="your tooltip text"></X>
```
Optionally, you can specify a location by assigning `data-tooltip-pos` attribute. Available values are:
- `"top left"`
- `"top middle"` (default)
- `"top right"`
- `"bottom left"`
- `"bottom middle"`
- `"bottom right"`
## High-Level Components
### Comment List
TODO
## Other
### JavaScript-Responsive Visibility
#### Hide if JavaScript is disabled
```html
<ANY class="nojs--hide"></ANY>
```
#### Hide if JavaScript is enabled
```html
<ANY class="hasjs--hide"></ANY>
```
See [vijos/vj4/vj4/ui/README.md](https://github.com/vijos/vj4/blob/master/vj4/ui/README.md)

@ -1,3 +1,5 @@
#!/bin/bash
for f in *.jpg
do
echo "$f..."

@ -2,10 +2,10 @@
#### 1. 收集的信息
我们收集信息是为了向所有用户提供更好的服务。我们有两种信息收集方式:
s
- 您向我们提供信息。在您注册 Hydro 帐户时我们会要求您提供个人信息例如您的电子邮件地址、QQ号码等。
- 我们在您使用服务的过程中获取信息。我们会收集关于您使用的服务以及使用方式的信息,例如您在何时使用了我们服务。
我们收集信息是为了向所有用户提供更好的服务。我们有两种信息收集方式:
- 您向我们提供信息。在您注册 Hydro 帐户时我们会要求您提供个人信息例如您的电子邮件地址、QQ号码等。
- 我们在您使用服务的过程中获取信息。我们会收集关于您使用的服务以及使用方式的信息,例如您在何时使用了我们服务。
#### 2. 如何使用收集到的信息
@ -34,11 +34,11 @@ s
请勿滥用我们的服务。如,请勿干扰我们的服务,或尝试使用除我们提供的界面和指示以外的方法访问这些服务,或使用我们服务中出现的缺陷干扰其他网站或设施的正常运行。您仅能在法律允许的范围内使用我们的服务。
您在使用我们服务时须遵守我们服务器所在地的法律法规,不得利用我们服务从事违法违规行为,包括但不限于:
- 发布、传送、传播、储存危害国家安全统一、破坏社会稳定、违反公序良俗、侮辱、诽谤、淫秽、暴力以及任何违反国家法律法规的内容;
- 发布、传送、传播、储存侵害他人知识产权、商业秘密等合法权利的内容;
- 恶意虚构事实、隐瞒真相以误导、欺骗他人;
- 发布、传送、传播广告信息及垃圾信息;
- 其他法律法规禁止的行为。
- 发布、传送、传播、储存危害国家安全统一、破坏社会稳定、违反公序良俗、侮辱、诽谤、淫秽、暴力以及任何违反国家法律法规的内容;
- 发布、传送、传播、储存侵害他人知识产权、商业秘密等合法权利的内容;
- 恶意虚构事实、隐瞒真相以误导、欺骗他人;
- 发布、传送、传播广告信息及垃圾信息;
- 其他法律法规禁止的行为。
如果您违反了约定相关国家相关机关或机构可能会对您提起诉讼、进行行政处罚或采取其他制裁措施Hydro 将给于协助。造成损害的您应依法予以赔偿Hydro 不承担任何责任。
如果 Hydro 发现或收到他人举报您发布的信息违反约定Hydro 有权进行独立判断并采取技术手段予以删除、屏蔽或断开链接。同时Hydro 有权视用户的行为性质,采取包括但不限于暂停或终止服务,限制、冻结或终止账户使用,追究法律责任等措施。
@ -56,11 +56,11 @@ s
您可以在 Hydro 上创建新题目。您上传到 Hydro 的题目,除了适用于本协议第三条(即“您在我们服务中发布的内容”)条款,还包含以下附加条款(若有冲突的条款,以附加条款中的优先):
- 您上传到 Hydro 上的题目版权为 Hydro 和您共同拥有,我们会在相关页面或在对其进行分发、传播等操作时标明版权所有者。
- Hydro 尊重他人知识产权和合法权益请您在上传题目前确保拥有题目内容包括但不限于题目描述、数据、图片等的著作权及信息网络传播权或者已经取得上述全部权利人的许可并不存在任何著作权纠纷。Hydro有权在不通知的情况下删除被认为侵权的题目。
- 您可以申请将自己上传的优质题目合并到题库主干。我们的管理员会对您创建的题目的内容(包括但不限于评测数据等对用户不可见的信息)进行人工审核和适当修改以确认其符合国家基本法律法规。出于质量的考虑,我们也可能会拒绝您完全合法的合并到题库主干的请求。
- 我们会维护服务的稳定,并对数据(包括您递交的题目)进行定期的备份,并尽量在关闭服务前通知您,但我们仍然不对任何题目(包括主干和非主干)提供永久存储或保留的承诺,出于安全的考虑推荐您自行保留题目的内容。
- 您有权决定 Hydro 是否公开您上传的题目的数据。公开题目数据意味着 Hydro 上的用户均有权利获取到您递交的题目的所有评测数据,但相关版权协议仍然生效。
- 您上传到 Hydro 上的题目版权为 Hydro 和您共同拥有,我们会在相关页面或在对其进行分发、传播等操作时标明版权所有者。
- Hydro 尊重他人知识产权和合法权益请您在上传题目前确保拥有题目内容包括但不限于题目描述、数据、图片等的著作权及信息网络传播权或者已经取得上述全部权利人的许可并不存在任何著作权纠纷。Hydro有权在不通知的情况下删除被认为侵权的题目。
- 您可以申请将自己上传的优质题目合并到题库主干。我们的管理员会对您创建的题目的内容(包括但不限于评测数据等对用户不可见的信息)进行人工审核和适当修改以确认其符合国家基本法律法规。出于质量的考虑,我们也可能会拒绝您完全合法的合并到题库主干的请求。
- 我们会维护服务的稳定,并对数据(包括您递交的题目)进行定期的备份,并尽量在关闭服务前通知您,但我们仍然不对任何题目(包括主干和非主干)提供永久存储或保留的承诺,出于安全的考虑推荐您自行保留题目的内容。
- 您有权决定 Hydro 是否公开您上传的题目的数据。公开题目数据意味着 Hydro 上的用户均有权利获取到您递交的题目的所有评测数据,但相关版权协议仍然生效。
#### 5. 隐私保护
@ -105,4 +105,4 @@ s
- 广告信息及垃圾信息;
- 其他法律法规禁止的内容。
对于违反《版规》的,我们将进行警告并删除相关内容、临时冻结用户、永久冻结用户等操作。
对于违反《版规》的,我们将进行警告并删除相关内容、临时冻结用户、永久冻结用户等操作。

@ -3,61 +3,63 @@
Hydro使用 [HydroJudger](https://github.com/hydro-dev/HydroJudger) 进行评测以docker镜像的形式安装至评测机。
所使用的编译器均为创建镜像时 [debian testing](https://wiki.debian.org/DebianTesting) 分支的最新版。编译参数如下:
- Free Pascal `fpc -O2 -o/out/foo /in/foo.pas`
- C `gcc -O2 -Wall -std=c99 -o /out/foo /in/foo.c -lm`
- C++ `g++ -O2 -Wall -std=c++11 -o /out/foo /in/foo.cc -lm`
- Java `javac Main.java`
- Python `python foo.py`
- Python 3 `python3 foo.py`
- PHP `php foo.php`
- Rust `rustc -O -o /out/foo /in/foo.rs`
- Haskell `ghc -O -outputdir /tmp -o /out/foo /in/foo.hs`
- Free Pascal `fpc -O2 -o/out/foo /in/foo.pas`
- C `gcc -O2 -Wall -std=c99 -o /out/foo /in/foo.c -lm`
- C++ `g++ -O2 -Wall -std=c++11 -o /out/foo /in/foo.cc -lm`
- Java `javac Main.java`
- Python `python foo.py`
- Python 3 `python3 foo.py`
- PHP `php foo.php`
- Rust `rustc -O -o /out/foo /in/foo.rs`
- Haskell `ghc -O -outputdir /tmp -o /out/foo /in/foo.hs`
# Limitations
Hydro 评测机使用进程的CPU时间计算时间消耗时间的限定为题目中评测点所指定的时间。
Hydro 评测机使用进程虚拟内存与物理内存总和计算内存空间消耗。内存空间默认限定为256MiB题目中特别指明的限定为题目中评测点所指定的内存空间。
Hydro 评测机使用进程虚拟内存与物理内存总和计算内存空间消耗。内存空间默认限定为256MiB题目中特别指明的限定为题目中评测点所指定的内存空间。
# IO
若无特殊说明Hydro 使用标准输入输出控制台输入输出屏幕输入输出STD I/O
若无特殊说明Hydro 使用标准输入输出控制台输入输出屏幕输入输出STD I/O
# Judge Status
- :::record-pending Waiting::: 评测:评测请求正在等待被评测机抓取
- :::record-progress Fetched::: 评测:评测请求已被评测机抓取,正在准备开始评测
- :::record-progress Compiling::: 评测:正在编译中
- :::record-progress Judging::: 评测:编译成功,正在评测中
- :::record-pass Accepted::: 通过:程序输出完全正确
- :::record-fail Wrong Answer::: 不通过:程序输出与标准答案不一致(不包括行末空格以及文件末空行)
- :::record-fail Time Exceeded::: 不通过:程序运行时间超过了题目限制
- :::record-fail Memory Exceeded::: 不通过:程序运行内存空间超过了题目限制
- :::record-fail Runtime Error::: 不通过:程序运行时错误(如数组越界、被零除、运算溢出、栈溢出、无效指针等)
- :::record-fail Compile Error::: 不通过:编译失败
- :::record-fail System Error::: 错误:系统错误(如果您遇到此问题,请及时在讨论区进行反馈)
- :::record-ignored Canceled::: 其他:评测被取消
- :::record-fail Unknown Error::: 其他:未知错误
:::note 有“成绩取消”字样则说明管理员手动标记此记录为取消,可能违反了服务条款,比如代码被发现与其他用户的代码十分相似。:::
- :::record-pending Waiting::: 评测:评测请求正在等待被评测机抓取
- :::record-progress Fetched::: 评测:评测请求已被评测机抓取,正在准备开始评测
- :::record-progress Compiling::: 评测:正在编译中
- :::record-progress Judging::: 评测:编译成功,正在评测中
- :::record-pass Accepted::: 通过:程序输出完全正确
- :::record-fail Wrong Answer::: 不通过:程序输出与标准答案不一致(不包括行末空格以及文件末空行)
- :::record-fail Time Exceeded::: 不通过:程序运行时间超过了题目限制
- :::record-fail Memory Exceeded::: 不通过:程序运行内存空间超过了题目限制
- :::record-fail Runtime Error::: 不通过:程序运行时错误(如数组越界、被零除、运算溢出、栈溢出、无效指针等)
- :::record-fail Compile Error::: 不通过:编译失败
- :::record-fail System Error::: 错误:系统错误(如果您遇到此问题,请及时在讨论区进行反馈)
- :::record-ignored Canceled::: 其他:评测被取消
- :::record-fail Unknown Error::: 其他:未知错误
:::note
有“成绩取消”字样则说明管理员手动标记此记录为取消,可能违反了服务条款,比如代码被发现与其他用户的代码十分相似。
:::
# Compile Error
可能有以下情况:
- 递交时选错了编程语言
- Java 的主类名没有使用 "Main"
- 对于 C/C++:见下
- 一般性的编译错误
- 递交时选错了编程语言
- Java 的主类名没有使用 "Main"
- 对于 C/C++:见下
- 一般性的编译错误
:::warn
对 C/C++ 选手的特别提醒:
<ul>
<li>1. __int64 在 GNU C++ 中应写成 long long 类型</li>
<li>2. main() 返回值必须定义为 int ,而不是 void</li>
<li>3. for 语句中的指标变量 i 将会在如"for (int i = 0...) {...}"语句之后变为无效</li>
<li>4. itoa 不是一个通用 ANSI 函数(标准 C/C++ 中无此函数)</li>
<li>5. printf 中使用 %lf 格式是不正确的</li>
</ul>
对 C/C++ 选手的特别提醒:
<ul>
<li>1. __int64 在 GNU C++ 中应写成 long long 类型</li>
<li>2. main() 返回值必须定义为 int ,而不是 void</li>
<li>3. for 语句中的指标变量 i 将会在如"for (int i = 0...) {...}"语句之后变为无效</li>
<li>4. itoa 不是一个通用 ANSI 函数(标准 C/C++ 中无此函数)</li>
<li>5. printf 中使用 %lf 格式是不正确的</li>
</ul>
:::
# Training
@ -66,23 +68,25 @@ Hydro 评测机使用进程虚拟内存与物理内存总和计算内存空间
# Contest
按照赛制不同,有不同的递交、排名规则。
OI 赛制所有题目均以最后一次递交为准,特别地,请避免编译错误。
OI 赛制排名规则为:总分高的排在前面,总分相等则排名相同。
ACM/ICPC 赛制所有题目递交后立即评测,以是否通过为准。
ACM/ICPC 赛制排名规则为:通过题目数多的排在前面,通过题目数相同的做题耗时(含罚时)少的排在前。
时间与空间限制以题目说明为准,默认限制参见[Limitations](#Limits)。
按照赛制不同,有不同的递交、排名规则。
OI 赛制所有题目均以最后一次递交为准,特别地,请避免编译错误。
OI 赛制排名规则为:总分高的排在前面,总分相等则排名相同。
ACM/ICPC 赛制所有题目递交后立即评测,以是否通过为准。
ACM/ICPC 赛制排名规则为:通过题目数多的排在前面,通过题目数相同的做题耗时(含罚时)少的排在前。
时间与空间限制以题目说明为准,默认限制参见[Limitations](#Limits)。
# Accepted Ratio
通过率的影响极其恶劣Hydro 不提供也不承认通过率。
通过率的影响极其恶劣Hydro 不提供也不承认通过率。
# RP
Hydro RP 分为固定 RP 与浮动 RP ,固定 RP 可由活动、比赛等的奖励获得,浮动 RP 由一般性通过题目获得。
浮动 RP 是一个动态的数值,每个用户在每道题上获得的 RP 都不一样,并且未来也不固定(即浮动之意)。
:::note 每道题的浮动 RP 由该题通过总人数与该用户通过此题的名次计算得来。:::
:::note
每道题的浮动 RP 由该题通过总人数与该用户通过此题的名次计算得来。
:::
# Dataset Format
@ -91,4 +95,4 @@ TODO
# Forgot Password and/or Username
如果您无法登录,请仔细想想,是不是用户名记错了。比如,自己原本想要注册的用户名已经被注册,所以使用了一个带有前和/或后缀的用户名。
如果您确信您的账号被盗或者忘记了账号和/或密码,请及时[{{ _('Reset Password or Find Username') }}](/lostpass)。
如果您确信您的账号被盗或者忘记了账号和/或密码,请及时[{{ _('Reset Password or Find Username') }}](/lostpass)。

Loading…
Cancel
Save