QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#664505#7755. Game on a ForestanlanyiWA 3ms4896kbC++201.1kb2024-10-21 20:54:492024-10-21 20:54:51

Judging History

你现在查看的是最新测评结果

  • [2024-10-21 20:54:51]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:4896kb
  • [2024-10-21 20:54:49]
  • 提交

answer

// #pragma GCC optimize(3,"Ofast","inline")
// #pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define point(n) fixed << setprecision(n)
#define IOS                      \
    ios::sync_with_stdio(false); \
    cin.tie(0), cout.tie(0);
#define endl '\n'
#define inf 0x3f3f3f3f
typedef long long ll;
typedef pair<ll, ll> PII;
typedef pair<ll, array<ll, 2>> PIA;
const int N = 1e6 + 10,mod=998244353;
const ll INF = 0x3f3f3f3f3f3f3f3f;
int  n, m, k;
int  f[N];
vector<int >h[N];
void solve()
{
    cin >> n >> m;
    int cnt=n+2*m;
    for(int i=1;i<n;i++){
        int a,b;
        cin >> a >> b;
        h[a].push_back(b);
        h[b].push_back(a);
    }
    int ans=0;
    if(n&1){
        if(m&1){
            ans=2*m;
        }else {
            ans=n+m;
        }
    }else {
        if(m&1){
            ans=m;

        }else {
            ans=0;
        }
    }
    cout<<ans<<'\n';
    
}
int main()
{
    IOS;
    int _ = 1;
    //cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3688kb

input:

3 1
1 2

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

4 3
1 2
2 3
3 4

output:

3

result:

ok 1 number(s): "3"

Test #3:

score: 0
Accepted
time: 3ms
memory: 4396kb

input:

100000 1
4647 17816

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: 0
Accepted
time: 0ms
memory: 4280kb

input:

100000 2
64075 72287
63658 66936

output:

0

result:

ok 1 number(s): "0"

Test #5:

score: 0
Accepted
time: 3ms
memory: 4352kb

input:

100000 3
59930 72281
31689 59132
20469 33165

output:

3

result:

ok 1 number(s): "3"

Test #6:

score: 0
Accepted
time: 0ms
memory: 4424kb

input:

100000 10
20391 78923
27822 80617
21749 25732
12929 79693
42889 52515
59064 99869
29031 41875
4463 17813
13407 42498
19120 20957

output:

0

result:

ok 1 number(s): "0"

Test #7:

score: -100
Wrong Answer
time: 3ms
memory: 4896kb

input:

99999 101
34378 94161
67696 83255
24557 25591
11476 58475
5684 38157
33843 35321
9046 24028
14293 77681
587 42098
9402 27228
6999 13980
27118 84005
3622 8353
13545 51621
16998 63647
32912 53178
15206 15815
56517 86335
5563 93770
153 278
11242 41753
75098 76792
1695 22836
25936 33352
2765 6778
19597 ...

output:

202

result:

wrong answer 1st numbers differ - expected: '200', found: '202'