给lkr的代码
作者:
ljw11
,
2023-04-08 12:06:19
,
所有人可见
,
阅读 225
给lkr的代码
$1292$ 谍战风云
#include <bits/stdc++.h>
using namespace std;
unordered_map<string, bool> d;
vector<string> g;
int main()
{
int a, b, c;
while (cin >> a >> b >> c)
{
if (a >= 0 && b >= 0 && c >= 0)
{
string s;
while (a--) cin >> s;
d.clear();
g.clear();
while (b--)
{
cin >> s;
g.push_back(s);
}
while (c--)
{
cin >> s;
d[s] = true;
}
bool flag = true;
for (auto e : g)
{
if (!d[e])
{
cout << e << ' ';
flag = false;
}
}
if (flag) cout << "No enemy spy";
puts("");
}
else puts("No enemy spy");
}
return 0;
}
$1305$ 米达斯系统
#include <bits/stdc++.h>
using namespace std;
struct item
{
int n, p, t;
bool operator< (const item e) const
{
if (t == e.t) return n > e.n;
return t > e.t;
}
} now;
priority_queue<item> heap;
int main()
{
string s;
while (cin >> s, s != "#")
{
int n, p;
scanf("%d%d", &n, &p);
heap.push({n, p, p});
}
int k;
scanf("%d", &k);
while (k--)
{
now = heap.top();
heap.pop();
printf("%d\n", now.n);
now.t += now.p;
heap.push(now);
}
return 0;
}