QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#371360#7986. 游戏24bot#WA 1ms6280kbC++141.2kb2024-03-30 08:40:492024-03-30 08:40:50

Judging History

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

  • [2024-03-30 08:40:50]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:6280kb
  • [2024-03-30 08:40:49]
  • 提交

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);
    }
    if(n == 1){puts("Wasted.");}
    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: 0ms
memory: 6280kb

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: 1ms
memory: 6192kb

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: 6272kb

input:

1

output:

Wasted.
You win, temporarily.

result:

wrong output format Extra information in the output file