QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#664462#7755. Game on a ForestanlanyiWA 3ms4264kbC++20962b2024-10-21 20:46:282024-10-21 20:46:29

Judging History

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

  • [2024-10-21 20:46:29]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:4264kb
  • [2024-10-21 20:46:28]
  • 提交

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);
    }
    if(n&1){
        cout<<(n+m)/2<<'\n';
    }else {
         cout<<m<<'\n';
    }
    
}
int main()
{
    IOS;
    int _ = 1;
    //cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}

详细

Test #1:

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

input:

3 1
1 2

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: 0
Accepted
time: 2ms
memory: 3608kb

input:

4 3
1 2
2 3
3 4

output:

3

result:

ok 1 number(s): "3"

Test #3:

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

input:

100000 1
4647 17816

output:

1

result:

ok 1 number(s): "1"

Test #4:

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

input:

100000 2
64075 72287
63658 66936

output:

2

result:

wrong answer 1st numbers differ - expected: '0', found: '2'