Submission #75092351
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N, M;
cin>>N>>M;
int A[M], B[M];
for (int i = 0; i<M; i++)
{
cin>>A[i]>>B[i];
}
vector<bool> getItem(N+1, false);
getItem[1] = true;
queue<int>q;
q.push(1);
while (!q.empty())
{
int x = q.front();
q.pop();
for (int i = 0; i<M; i++)
{
if (A[i]==x)
{
if (getItem[B[i]]==false)
{
getItem[B[i]] = true;
q.push(B[i]);
}
}
}
}
int ans = 0;
for (int i = 1; i<=N; i++)
{
if (getItem[i])
{
ans++;
}
}
cout<<ans<<endl;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Straw Millionaire |
| User | Yugo0716 |
| Language | C++23 (GCC 15.2.0) |
| Score | 0 |
| Code Size | 815 Byte |
| Status | TLE |
| Exec Time | > 2000 ms |
| Memory | 6384 KiB |
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 300 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 01_handmade_08.txt, 01_handmade_09.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 03_killer_00.txt, 03_killer_01.txt, 03_killer_02.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 3596 KiB |
| 00_sample_01.txt | AC | 1 ms | 3568 KiB |
| 00_sample_02.txt | AC | 1 ms | 3700 KiB |
| 01_handmade_00.txt | AC | 50 ms | 6036 KiB |
| 01_handmade_01.txt | AC | 49 ms | 6072 KiB |
| 01_handmade_02.txt | AC | 51 ms | 6132 KiB |
| 01_handmade_03.txt | AC | 125 ms | 6060 KiB |
| 01_handmade_04.txt | AC | 94 ms | 5756 KiB |
| 01_handmade_05.txt | TLE | > 2000 ms | 5744 KiB |
| 01_handmade_06.txt | TLE | > 2000 ms | 5664 KiB |
| 01_handmade_07.txt | TLE | > 2000 ms | 5664 KiB |
| 01_handmade_08.txt | TLE | > 2000 ms | 5648 KiB |
| 01_handmade_09.txt | TLE | > 2000 ms | 4848 KiB |
| 02_random_00.txt | AC | 116 ms | 5884 KiB |
| 02_random_01.txt | TLE | > 2000 ms | 5500 KiB |
| 02_random_02.txt | AC | 205 ms | 5036 KiB |
| 02_random_03.txt | TLE | > 2000 ms | 5720 KiB |
| 02_random_04.txt | AC | 337 ms | 6132 KiB |
| 02_random_05.txt | AC | 86 ms | 5828 KiB |
| 03_killer_00.txt | TLE | > 2000 ms | 6384 KiB |
| 03_killer_01.txt | TLE | > 2000 ms | 6384 KiB |
| 03_killer_02.txt | TLE | > 2000 ms | 5748 KiB |