马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 zhangjinxuan 于 2023-6-8 14:20 编辑
中文题目
OLO的全球锦标赛ISM正在如火如荼地进行,Shizuku是参加锦标赛的GNR的忠实粉丝。OLO是一种由五名玩家组成的两支队伍相互比赛的游戏。PENTA KILL在游戏中被认为是一个令人难以置信的成就,这意味着一名玩家连续杀死五个成对的不同对手。我们假设一个玩家在死后会立即复活,并且死亡不会影响对其PENTA KILL的判决。
通常情况下,PENTA KILL将显示在游戏中。然而,有时由于竞争团队之间的延迟存在意外差异,因此无法在游戏中正确显示。游戏结束后,Shizuku会得到一份按时间顺序排列的游戏中的击杀列表。她想知道一个玩家是否在这个游戏中获得了PENTA KILL。
输入
第一行包含一个整数n(1≤n≤1000),表示游戏中的击杀次数。
以下n行中的每一行都包含两个字符串a和b,由英文字母和数字组成,表示名为a的玩家杀死了名为b的玩家。
每个字符串的长度不会超过100,可以保证队友之间不会发生杀戮,并且每支球队只有五名球员。
输出
如果玩家打成了 “五杀”,请输出 "PENTA KILL!",否则输出 "SAD:("
英文题目
OLO's global tournament, ISM, is in full swing and Shizuku is a big fan of GNR which is taking part in the tournament. OLO is a game where two teams of five players play against each other. PENTA KILL is considered an unbelievable achievement in the game, which means one player kills five pairwise distinct opponents in a row. We assume that a player will be resurrected immediately after his death, and the death will not affect the verdict of his PENTA KILL.
Normally, PENTA KILL will be displayed in the game. However, sometimes due to unintended disparity in latency between competing teams, it is not displayed properly in the game. After the game, Shizuku gets a chronological list of kills during the game. She wants to know whether a player has achieved PENTA KILL in this game.
Input
The first line contains an integer n(1≤n≤1000), indicating the number of kills in the game.
Each of the following n lines contains two strings a and b consisting of English letters and digital numbers, indicating that the player named a kills the player named b. The length of each string won't exceed 100. It is guaranteed that there are no kills between teammates and there are exactly five players per team.
Output
Output PENTA KILL! if a player has achieved "PENTA KILL", or "SAD:(" otherwise.
我的代码#include <bits/stdc++.h>
using namespace std;
int t, slen, tlen;
string s1, t2;
map<string, map<string, bool>> tmp;
map<string, int> cnt;
int main() {
scanf("%d", &t);
while(t--) {
cin >> s1 >> t2;
if (tmp[s1][t2]) {
tmp[s1].clear();
tmp[s1][t2] = 1;
cnt[s1] = 1;
} else {
cnt[s1]++;
tmp[s1][t2] = 1;
}
if (cnt[s1] >= 5) {
puts("PENTA KILL!");
return 0;
}
}
puts("SAD:(");
return 0;
}
一直wa,一直wa,总是wa,waaaaa,我崩溃了
|