Submission #72336

# Submission time Handle Problem Language Result Execution time Memory
72336 2018-08-26T07:13:50 Z 유애나(#2199, kdh9949) Chocolate Cookie Machine (FXCUP3_chocolate) C++17
100 / 100
1343 ms 29328 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 300005;

int n, k, m, dan[N], lnk[N], ulnk[N], q, lc, ulc;
vector<int> e[N], r;

int main(){
    scanf("%d%d%d", &n, &k, &m);
    for(int x; k--; ){
        scanf("%d", &x);
        dan[x] = 1;
    }
    for(int x, y; m--; ){
        scanf("%d%d", &x, &y);
        if(dan[x] || dan[y]) continue;
        e[x].push_back(y);
        e[y].push_back(x);
    }
    scanf("%d ", &q);
    for(int x; q--; ){
        char buf[10];
        scanf("%*s%*s%d%*s%s", &x, buf);
        if(buf[0] == 'B'){
            if(dan[x]) continue;
            for(int i : e[x]) lnk[i]++;
            lc++;
        }
        else{
            for(int i : e[x]) ulnk[i]++;
            ulc++;
        }
    }
    for(int i = 1; i <= n; i++){
        if(ulc && (!dan[i] && lnk[i] == lc && !ulnk[i])) r.push_back(i);
        if(!ulc && (dan[i] || lnk[i] == lc)) r.push_back(i);
    }
    printf("%d\n", r.size());
    for(int i : r) printf("%d ", i);
    puts("");
    return 0;
}

Compilation message

chocolate.cpp: In function 'int main()':
chocolate.cpp:39:28: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
     printf("%d\n", r.size());
                    ~~~~~~~~^
chocolate.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &n, &k, &m);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
chocolate.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &x);
         ~~~~~^~~~~~~~~~
chocolate.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &x, &y);
         ~~~~~^~~~~~~~~~~~~~~~
chocolate.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d ", &q);
     ~~~~~^~~~~~~~~~~
chocolate.cpp:24:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%*s%*s%d%*s%s", &x, buf);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 9 ms 7380 KB Output is correct
2 Correct 9 ms 7400 KB Output is correct
3 Correct 14 ms 7712 KB Output is correct
4 Correct 103 ms 11504 KB Output is correct
5 Correct 11 ms 11504 KB Output is correct
6 Correct 9 ms 11504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 620 ms 18984 KB Output is correct
2 Correct 95 ms 18984 KB Output is correct
3 Correct 284 ms 18984 KB Output is correct
4 Correct 1024 ms 24132 KB Output is correct
5 Correct 261 ms 24132 KB Output is correct
6 Correct 54 ms 24132 KB Output is correct
7 Correct 1066 ms 25076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 7380 KB Output is correct
2 Correct 9 ms 7400 KB Output is correct
3 Correct 14 ms 7712 KB Output is correct
4 Correct 103 ms 11504 KB Output is correct
5 Correct 11 ms 11504 KB Output is correct
6 Correct 9 ms 11504 KB Output is correct
7 Correct 620 ms 18984 KB Output is correct
8 Correct 95 ms 18984 KB Output is correct
9 Correct 284 ms 18984 KB Output is correct
10 Correct 1024 ms 24132 KB Output is correct
11 Correct 261 ms 24132 KB Output is correct
12 Correct 54 ms 24132 KB Output is correct
13 Correct 1066 ms 25076 KB Output is correct
14 Correct 27 ms 25076 KB Output is correct
15 Correct 22 ms 25076 KB Output is correct
16 Correct 934 ms 25076 KB Output is correct
17 Correct 219 ms 25076 KB Output is correct
18 Correct 1130 ms 29328 KB Output is correct
19 Correct 1343 ms 29328 KB Output is correct
20 Correct 950 ms 29328 KB Output is correct
21 Correct 936 ms 29328 KB Output is correct
22 Correct 1000 ms 29328 KB Output is correct
23 Correct 700 ms 29328 KB Output is correct