Submission #342465

# Submission time Handle Problem Language Result Execution time Memory
342465 2021-01-02T07:17:19 Z urd05 Spring cleaning (CEOI20_cleaning) C++14
9 / 100
31 ms 748 KB
#include <bits/stdc++.h>
using namespace std;

int used[100000];

int main(void) {
    int n;
    scanf("%d",&n);
    int q;
    scanf("%d",&q);
    for(int i=1;i<n;i++) {
        int u,v;
        scanf("%d %d",&u,&v);
    }
    int x;
    scanf("%d",&x);
    int l=n-1;
    int ret=0;
    for(int i=0;i<x;i++) {
        int v;
        scanf("%d",&v);
        v--;
        if (used[v]) {
            l++;
        }
        used[v]++;
    }
    for(int i=1;i<n;i++) {
        if (used[i]%2==0&&used[i]>0) {
            ret++;
        }
    }
    printf("%d",(l%2==0?n-1+x+ret:-1));
}

Compilation message

cleaning.cpp: In function 'int main()':
cleaning.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    8 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
cleaning.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |     scanf("%d",&q);
      |     ~~~~~^~~~~~~~~
cleaning.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 |         scanf("%d %d",&u,&v);
      |         ~~~~~^~~~~~~~~~~~~~~
cleaning.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |     scanf("%d",&x);
      |     ~~~~~^~~~~~~~~
cleaning.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |         scanf("%d",&v);
      |         ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 364 KB Output is correct
2 Correct 11 ms 364 KB Output is correct
3 Correct 19 ms 748 KB Output is correct
4 Correct 24 ms 620 KB Output is correct
5 Correct 31 ms 748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -