QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#371353#7986. 游戏24bot#WA 2ms6324kbC++141.1kb2024-03-30 08:31:592024-03-30 08:32:00

Judging History

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

  • [2024-03-30 08:32:00]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:6324kb
  • [2024-03-30 08:31:59]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
bool stmemory;
namespace Call_me_Eric{
inline int read(){
    int x = 0, f = 1;char ch = getchar();
    while(ch < '0' || ch > '9'){if(ch == '-') f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = (x << 1) + (x << 3) + (ch ^ 48);ch = getchar();}
    return x * f;
}
const int maxn = 1e5 + 10;
int n;
vector<int> edg[maxn];
bool f[maxn];
void dfs(int u,int fa){
    bool leaf = true;int cnt = 0;
    for(int v : edg[u])if(v != fa){
        dfs(v, u);leaf = false;
        cnt += f[v];
    }
    if(leaf || cnt >= 2)f[u] = 1;
}
void main(){
    n = read();int u, v;
    for(int i = 1;i < n;i++){
        u = read(); v = read();
        edg[u].push_back(v);edg[v].push_back(u);
    }
    dfs(1,0);
    puts((f[1] || edg[1].size() == 1) ? "You win, temporarily." : "Wasted.");
    return;
}
};
bool edmemory;
signed main(){
    auto stclock = clock();
    Call_me_Eric::main();
    auto edclock = clock();
    cerr << (&stmemory - &edmemory) / 1024.0 / 1024.0 << " Mib cost.\n";
    cerr << (edclock - stclock) * 1.0 / CLOCKS_PER_SEC << " Sec cost.\n";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 6324kb

input:

6
1 2
2 3
2 4
1 5
5 6

output:

Wasted.

result:

ok single line: 'Wasted.'

Test #2:

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

input:

7
1 2
2 3
2 4
1 5
5 6
5 7

output:

You win, temporarily.

result:

ok single line: 'You win, temporarily.'

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 6124kb

input:

1

output:

You win, temporarily.

result:

wrong answer 1st lines differ - expected: 'Wasted.', found: 'You win, temporarily.'