Submission #788220

# Submission time Handle Problem Language Result Execution time Memory
788220 2023-07-20T02:27:49 Z Username4132 Povjerenstvo (COI22_povjerenstvo) C++14
13 / 100
211 ms 73168 KB
#include<iostream>
#include<vector>
using namespace std;
#define forn(i, n) for(int i=0; i<(int)n; ++i)
#define PB push_back

const int MAXN = 500010;
bool yes[MAXN], vis[MAXN];
int n, m, ans;
vector<int> g[MAXN];

void dfs(int v){
    vis[v]=true;
    bool res=false;
    for(int to:g[v]){
        if(!vis[to]) dfs(to);
        res|=yes[to];
    }
    yes[v]=!res;
}

int main(){
    scanf("%d %d", &n, &m);
    forn(i, m){
        int a, b; scanf("%d %d", &a, &b); --a, --b;
        g[a].PB(b);
    }
    forn(i, n) if(!vis[i]) dfs(i);
    forn(i, n) ans+=yes[i];
    printf("%d\n", ans);
    forn(i, n) if(yes[i]) printf("%d ", i+1);
    printf("\n");
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:23:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |     scanf("%d %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:25:24: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |         int a, b; scanf("%d %d", &a, &b); --a, --b;
      |                   ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 147 ms 73132 KB Output is correct
2 Correct 125 ms 39500 KB Output is correct
3 Correct 6 ms 11988 KB Output is correct
4 Correct 53 ms 16204 KB Output is correct
5 Correct 76 ms 25816 KB Output is correct
6 Correct 104 ms 21912 KB Output is correct
7 Correct 99 ms 32604 KB Output is correct
8 Correct 148 ms 27784 KB Output is correct
9 Correct 133 ms 36384 KB Output is correct
10 Correct 173 ms 27796 KB Output is correct
11 Correct 165 ms 31364 KB Output is correct
12 Correct 179 ms 28920 KB Output is correct
13 Correct 151 ms 29344 KB Output is correct
14 Correct 147 ms 29428 KB Output is correct
15 Correct 142 ms 29492 KB Output is correct
16 Correct 135 ms 29560 KB Output is correct
17 Correct 41 ms 15692 KB Output is correct
18 Correct 68 ms 18452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 160 ms 73168 KB Output is correct
2 Correct 118 ms 22072 KB Output is correct
3 Correct 95 ms 31660 KB Output is correct
4 Correct 158 ms 30892 KB Output is correct
5 Correct 211 ms 31344 KB Output is correct
6 Incorrect 164 ms 30344 KB There must not be two people within the committee such that one person dislikes the other.
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 12616 KB Output is correct
2 Correct 6 ms 12116 KB Output is correct
3 Correct 6 ms 12244 KB Output is correct
4 Correct 6 ms 12196 KB Output is correct
5 Incorrect 10 ms 12188 KB There must not be two people within the committee such that one person dislikes the other.
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 147 ms 73132 KB Output is correct
2 Correct 125 ms 39500 KB Output is correct
3 Correct 6 ms 11988 KB Output is correct
4 Correct 53 ms 16204 KB Output is correct
5 Correct 76 ms 25816 KB Output is correct
6 Correct 104 ms 21912 KB Output is correct
7 Correct 99 ms 32604 KB Output is correct
8 Correct 148 ms 27784 KB Output is correct
9 Correct 133 ms 36384 KB Output is correct
10 Correct 173 ms 27796 KB Output is correct
11 Correct 165 ms 31364 KB Output is correct
12 Correct 179 ms 28920 KB Output is correct
13 Correct 151 ms 29344 KB Output is correct
14 Correct 147 ms 29428 KB Output is correct
15 Correct 142 ms 29492 KB Output is correct
16 Correct 135 ms 29560 KB Output is correct
17 Correct 41 ms 15692 KB Output is correct
18 Correct 68 ms 18452 KB Output is correct
19 Correct 160 ms 73168 KB Output is correct
20 Correct 118 ms 22072 KB Output is correct
21 Correct 95 ms 31660 KB Output is correct
22 Correct 158 ms 30892 KB Output is correct
23 Correct 211 ms 31344 KB Output is correct
24 Incorrect 164 ms 30344 KB There must not be two people within the committee such that one person dislikes the other.
25 Halted 0 ms 0 KB -