# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
726067 |
2023-04-18T12:17:42 Z |
Johann |
Viruses (BOI20_viruses) |
C++14 |
|
1 ms |
340 KB |
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
#define all(x) (x).begin(), (x).end()
int G, N, M;
vi key;
vvi values;
vi ans;
vi done;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> G >> N >> M;
key.resize(N), values.resize(N);
for (int i = 0, a, k; i < N; ++i)
{
cin >> a >> k;
key[i] = a;
values[i].assign(G, 0);
for (int j = 0, c; j < k; ++j)
cin >> c, ++values[i][c];
}
bool con = true;
done.assign(N, false);
ans.assign(G, -1);
while (con)
{
con = false;
pii idx = {1LL << 60, -1};
for (int i = 0; i < N; ++i)
{
if (!done[i])
{
ll allStuff = accumulate(all(values[i]), 0LL);
if (allStuff == values[i][0] + values[i][1])
idx = min(idx, {allStuff, i});
}
}
if (idx.second != -1)
{
done[idx.second] = true;
con = true;
int k = key[idx.second];
if (ans[k] == -1)
ans[k] = idx.first;
for (int i = 0; i < N; ++i)
{
values[i][0] += idx.first * values[i][k];
values[i][k] = 0;
}
}
}
for (int i = 2; i < G; ++i)
{
cout << "NO " << ans[i] << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |