@[chen_zhe](/space/show?uid=8457) @[lin_toto](/space/show?uid=256)
by brealid @ 2019-08-27 19:05:02
@[nacly_fish](/user/115864) @[xht37](/user/100544)
by _•́へ•́╬_ @ 2020-01-18 23:02:31
@[StudyingFather](/user/22030)
by Alan_Zhao @ 2020-02-09 10:03:52
@[Jomoo](/user/63720) added & thanks
by StudyingFather @ 2020-02-09 11:48:48
【原大号 Jomoo 被禁言,此小号代替 Jomoo 发信息】
@[StudyingFather](/user/22030) 抱歉,能否重新改一下? spj 原本是在 C++03 标准下写的,不小心触犯了 C++11 的标准(使用了 ``rank`` 作为函数名)。
更改后的 spj:
```cpp
#include "testlib.h"
using namespace std;
int n;
map<string, int> rak;
string s, diff;
int main(int argc, char* argv[])
{
registerTestlibCmd(argc, argv);
n = inf.readInt();
inf.readEoln();
for (int i = 1; i <= n; i++) {
s = ouf.readString();
rak[s] = i;
}
for (int i = 1; i <= n; i++) {
s = inf.readString();
diff = inf.readString();
// printf("%s %s\n", s.c_str(), diff.c_str());
switch (diff[0]) {
case 'U' :
// UP
if (i >= rak[s]) quitf(_wa, "The answer is wrong: song %s's now rank is %d (UP), your original rank is %d.", s.c_str(), i, rak[s]);
break;
case 'D' :
// DOWN
if (i <= rak[s]) quitf(_wa, "The answer is wrong: song %s's now rank is %d (DOWN), your original rank is %d.", s.c_str(), i, rak[s]);
break;
case 'S' :
// SAME
if (i != rak[s]) quitf(_wa, "The answer is wrong: song %s's now rank is %d (SAME), your original rank is %d.", s.c_str(), i, rak[s]);
break;
}
}
quitf(_ok, "The answer is acceptable.");
return 0;
}
```
by hkxadpall @ 2020-02-09 14:26:30
@[hkxadpall](/user/85848) fixed.
by StudyingFather @ 2020-02-09 15:29:54