Skip to main content

Python library of IT Club PTIT HN

Project description

Mục lục

1. Tổ chức & Mô tả

2. Ví dụ sử dụng



Nội dung

1. Tổ chức & Mô tả

itptit
|
|___common
|   |___math
|   |   |___...
|   |
|   |___random
|   |   |___Random
|   |   |___...
|   |
|   |___exceptions
|       |___...
|
|___generator
|   |___TestCaseFamily
|   |___Inerator
|   |___Outerator
|
|___judge
    |___SingleJudge
    |___MultiJudge
    |___...

Mô tả

Nội dung các class và function sẽ được mô tả bởi python docstring.

2. Ví dụ sử dụng

2.1. Problem

Tính tổng các số có trong dãy n phần tử với 2 ≤ n ≤ 3.

Input Output
1 2 3
1 2 3 6

2.1. Files

  • real_solution.py

ans = 0
for i in input().split():
    ans += int(i)
print(ans)
  • submitted_solution.cpp

#include <iostream>
using namespace std;

int main(){
    int x, y;
    cin >> x >> y;
    cout << x + y;
    return 0;
}
  • gen_test_case.py

from itptit.common.math import *
from itptit.common.random import *
from itptit.generator import TestCaseFamily, Inerator, Outerator
from itptit.judge import SingleJudge

def _2_numbers(x, y):
    print(x, y)

def _3_numbers(x, y, z):
    print(x, y, z)


# Create TestCaseFamily

tcf1 = TestCaseFamily(
    gen_func=_2_numbers,
    number_of_test_cases=2,
    args_list=[
        [1, 2],
        [2, 3]
    ]
)

tcf2 = TestCaseFamily(
    gen_func=_3_numbers,
    number_of_test_cases=3,
    args_list=[
        [1, 2, 3],
        [2, 3, 4],
        [3, 4, 5]
    ],
    name='3 numbers'                # Optional argument
)

# Generate input

ig = Inerator(
    'test/input',
    tcf1,
    tcf2,
    file_extension='itqh'           # Optional argument
)

ig.start()

# Generate output

og = Outerator(
    'test/input',
    'real_solution.py',
    'test/output',
    input_file_extension='itqh',    # Optional argument
    file_extension='otqh'           # Optional argument
)

og.start()

# Judgement

judge = SingleJudge(
    'test/input',
    'test/output',
    'submitted_solution.cpp', 
    time_limit=1,                   # Optional argument
    input_extension='itqh',         # Optional argument
    output_extension='otqh'         # Optional argument
)

judge.start()
  • Run "gen_test_case.py"

Start generating input for test cases:
- New: Created file "0.itqh" successfully in 0.00000s!
- New: Created file "1.itqh" successfully in 0.00000s!
- New: Created file "2.itqh" successfully in 0.00000s!
- New: Created file "3.itqh" successfully in 0.00000s!
- New: Created file "4.itqh" successfully in 0.00050s!
All test case's inputs have been generated.

Start generating output for test cases:
- New: Created file "0.otqh" successfully in 0.07481s!
- New: Created file "1.otqh" successfully in 0.10607s!
- New: Created file "2.otqh" successfully in 0.07828s!
- New: Created file "3.otqh" successfully in 0.06917s!
- New: Created file "4.otqh" successfully in 0.07155s!
All test case's outputs have been generated.

Start judgment:
- Testcase 0."0": Accepted (AC) in 0.063s.
- Testcase 1."1": Accepted (AC) in 0.082s.
- Testcase 2."2": Wrong answer (WA).
- Testcase 3."3": Wrong answer (WA).
- Testcase 4."4": Wrong answer (WA).
  > Result: Partial (2/5).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

itptit-1.0.2-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

Details for the file itptit-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: itptit-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 27.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.0

File hashes

Hashes for itptit-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b3402eff5df9bb1e5250840716cdba69611ad9daef1823ac91d181e10bfc51d5
MD5 4dee33d1ee82f8d0f9a9001978a496f1
BLAKE2b-256 a073905ce29d8bbb7bcdb52f3112702fb0d3d26a7a260b7a07a930688ff5a562

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page