Блог пользователя kimiyuki

Автор kimiyuki, история, 4 года назад, По-английски

Hi Codeforces!

Today I would like to intoruce my template generator, online-judge-tools/template-generator. This program can analyze problems of competitive programming and generate boilerplate codes including input part, output part, MOD, etc.

For example, for a probelm https://codeforces.me/contest/1300/problem/D, my command oj-template https://codeforces.me/contest/1300/problem/D prints the following source code. All of input part and output part is already written in main function, and what you need to write is only the solve function.

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define ALL(x) ::std::begin(x), ::std::end(x)
using namespace std;

const string YES = "YES";
const string NO = "nO";
bool solve(int n, const vector<int64_t> & a, const vector<int64_t> & b) {
    // TODO: edit here
}

// generated by online-judge-template-generator v4.4.0 (https://github.com/kmyk/online-judge-template-generator)
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    constexpr char endl = '\n';
    int n;
    cin >> n;
    vector<int64_t> a(n), b(n);
    REP (i, n) {
        cin >> a[i] >> b[i];
    }
    auto ans = solve(n, a, b);
    cout << (ans ? YES : NO) << endl;
    return 0;
}

Also this can generates generators for random cases. You can combine the generator with my another tool online-judge-tools/oj and use them for stress tests, i.e. generating many testcases randomly and run tests against them until a hack testcase for your program is found.

Enjoy!

  • Проголосовать: нравится
  • +39
  • Проголосовать: не нравится