# 1440: OJ 的继承与派生（19年期末机考T3）

### 题目描述

#### ICPCJudger

`ICPCJudger` 的构造方式， `judger = new ICPCJudger(time_limit, memory_limit, answer);`

`ICPCJudger``Submit` 评测标准是：

`time <= time_limit && memory <= memory_limit` 并且答案正确时给 100 分，其余都给零分；

#### OIJudger

`OIJudger` 的构造方式， `judger = new OIJudger(time_limit, memory_limit, answer);`

`OIJudger``Submit` 评测标准是：

`time <= time_limit && memory <= memory_limit` 并且答案正确时给 100 分，其余都给零分；

#### SpacialJudger

`SpacialJudger` 的构造方式，`judger = new SpacialJudger(time_limit, memory_limit, full_score_time, full_score_memory, answer);`

`SpacialJudger``Submit` 评测标准：

# include

class BaseJudger { public: BaseJudger (size_t time_limit , size_t memory_limit , const char *answer) // todo }

``````virtual void Submit (size_t time , size_t memory , const char *output) = 0;

size_t GetScore () const { return score_; }

virtual ~BaseJudger () {
// todo
};
``````

protected: char *answer_; const size_t time_limit_; const size_t memory_limit_; size_t score_;

``````virtual bool CheckAnswer (const char *output) const {
// the output must equal to the answer
return strcmp(answer_ , output) == 0;
}
``````

};

class OIJudger // todo

class ICPCJudger // todo

class SpacialJudger // todo ```

# include "code3.hpp"

using namespace std;

string get_data () { // ignore empty lines string ret = "" , line; while (getline(cin , line)) { if (line.length() == 0) { continue; } if (line == "#####") { break; } ret += line + "\n"; } return std::move(ret); }

int main () { char judger_name[100]; cin >> judger_name; size_t time_limit , mem_limit; cin >> time_limit >> mem_limit; BaseJudger *judger = nullptr; string tmp; if (strcmp(judger_name , "OIJudger") == 0) { tmp = get_data(); judger = new OIJudger(time_limit , mem_limit , tmp.c_str()); } else if (strcmp(judger_name , "ICPCJudger") == 0) { tmp = get_data(); judger = new ICPCJudger(time_limit , mem_limit , tmp.c_str()); } else if (strcmp(judger_name ,"SpacialJudger") == 0) { size_t full_score_time , full_score_memory; cin >> full_score_time >> full_score_memory; tmp = get_data(); judger = new SpacialJudger(time_limit , mem_limit , full_score_time , full_score_memory , tmp.c_str()); } else { cout << "Unknown Judger type" << endl; return 0; }

``````size_t submit_time , submit_mem;
while (cin >> submit_time >> submit_mem) {
tmp = get_data();
const char *output = tmp.c_str();
judger->Submit(submit_time , submit_mem , output);
}
cout << judger->GetScore() << endl;
delete judger;
return 0;
``````

} ```

### 样例输入

```text ICPCJudger 1000 1000 abcd dcba

500 1001 abcd dcba

500 500 abcd dcba

```

### 样例输出

```text 100```

### 数据范围

\$1-4\$ 测试点， `judger_name = ICPCJudger`

\$5-7\$ 测试点， `judger_name = SpacialJudger`

\$8-10\$ 测试点， `judger_name = OIJudger`

## Oops! 本题目还没有解答！

OJ翻了一新，但本解答集还大多用的是2017-2019级，甚至更早的同学们贡献的答案。