Windows 10にTopCoderのための環境を構築したときの簡易的なメモです。
Javaランタイムのインストール
- Java SE Runtime Environment 8 - Downloads からJavaのランタイムを入れる
- chocolateyを入れている場合、
choco install jre8
でもいいはず
Java Appletの入手
サイトリストの追加
- デフォルトだとJava AppletからTopCoderのサイトへの通信がブロックされるので以下を行う
- 「Javaの構成」→「セキュリティ」タブ→「サイト・リストの編集」→「追加」で以下を記入 (参考:Unable to open topcoder contestApplet(Java version issue) - Codeforces)
http://topcoder.com http://www.topcoder.com http://arena.topcoder.com https://topcoder.com https://www.topcoder.com https://arena.topcoder.com
- 追加後の画面の一例
greedプラグインの導入
greedプラグインを入れることで、テンプレートを自動挿入したり、手元でのテストが簡単に行えたりが簡単になる。
- GitHub - shivawu/topcoder-greed: greedy editor for topcoder arena から「2.0-RC (Updated, Comptiable with Arena 7.1.0, 2014/2/18)」をクリックして「Greed-2.0-RC-7.1.0.jar」を入手
- jarファイルを適当な場所に置く。私の場合は
C:\lib\topcoder
に置いている - TopCoder の強欲プラグイン、Greed を使う! - Qiita に従い設定
私の場合は以下のように設定ファイルを書いている。
- workspaceとして設定したディレクトリに
greed.conf
という名前で以下のファイルを作成
greed.language.cpp.templateDef.source.templateFile = "my_template.cpp" greed.language.python.templateDef.source.templateFile = "my_template.py"
- 同ディレクトリに
my_template.cpp
という名前で以下のファイルを作成
#include <iostream> #include <sstream> #include <string> #include <cassert> #include <cmath> #include <climits> #include <cstdio> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <algorithm> #include <functional> #include <numeric> #include <iomanip> #include <cstring> #include <fstream> using namespace std; typedef unsigned int uint; typedef long long ll; typedef unsigned long long ull; #define REP(i,n) for(int i = 0; i < (int)(n); ++i) #define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i) #define ALL(c) (c).begin(), (c).end() #define SIZE(v) ((int)v.size()) #define pb push_back #define mp make_pair #define mt make_tuple using namespace std; class ${ClassName} { public: ${Method.ReturnType} ${Method.Name}(${Method.Params}) { return ${Method.ReturnType;zeroval}; } }; ${CutBegin} ${<TestCode} ${CutEnd}
- 同ディレクトリに
my_template.py
という名前で以下のファイルを作成
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import array from bisect import * from collections import * import fractions import heapq from itertools import * import math import re import string class ${ClassName}: def ${Method.Name}(self, ${Method.Params}): return ${Method.ReturnType;zeroval} ${CutBegin} ${<TestCode} ${CutEnd}