Submission #583896

# Submission time Handle Problem Language Result Execution time Memory
583896 2022-06-26T12:49:21 Z MrDeboo Sleepy game (innopolis2018_final_D) C++17
19 / 100
115 ms 17380 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define endl '\n'
using namespace std;
using namespace __gnu_pbds;
using ordered_set = tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>;
vector<int>vct[100001];
vector<int>tcv[100001];
pair<int,int>vis[100001][2];
signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    for(int i=0;i<100001;i++){
        vis[i][0]={-1,-1};
        vis[i][1]={-1,-1};
    }
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        int k;
        cin>>k;
        while(k--){
            int x;
            cin>>x;
            tcv[x].push_back(i);
            vct[i].push_back(x);
        }
    }
    int in;
    cin>>in;
    deque<pair<int,int>>dq;
    for(int i=1;i<=n;i++){
        if(vct[i].empty())dq.push_back({i,0});
    }
    if(dq.empty()){
        cout<<"Draw";
        return 0;
    }
    while(dq.size()){
        int a=dq.front().first,b=dq.front().second;
        dq.pop_front();
        for(auto &i:tcv[a]){
            if(vis[i][b^1].first==-1){
                vis[i][b^1]={a,b};
                dq.push_back({i,b^1});
            }
        }
    }
    if(vis[in][1].first==-1){
        cout<<"Lose";
        return 0;
    }
    cout<<"Win\n";
    int a=in,b=1;
    while(vis[a][b].first!=-1){
        cout<<a<<' ';
        int A=a,B=b;
        a=vis[A][B].first;
        b=vis[A][B].second;
    }
    cout<<a;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8148 KB Correct solution.
2 Incorrect 4 ms 8148 KB Participant's answer is Lose, but jury's is Draw.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 8148 KB Correct solution.
2 Correct 5 ms 8120 KB Correct solution.
3 Correct 6 ms 8148 KB Correct solution.
4 Correct 79 ms 16920 KB Correct solution.
5 Correct 5 ms 8148 KB Correct solution.
6 Correct 12 ms 9044 KB Correct solution.
7 Correct 115 ms 17264 KB Correct solution.
8 Correct 70 ms 17380 KB Correct solution.
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8148 KB Correct solution.
2 Correct 4 ms 8148 KB Correct solution.
3 Correct 5 ms 8276 KB Correct solution.
4 Correct 5 ms 8148 KB Correct solution.
5 Correct 4 ms 8152 KB Correct solution.
6 Correct 5 ms 8168 KB Correct solution.
7 Correct 5 ms 8276 KB Correct solution.
8 Correct 5 ms 8148 KB Correct solution.
9 Incorrect 5 ms 8160 KB Participant's answer is Lose, but jury's is Draw.
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8148 KB Correct solution.
2 Correct 4 ms 8148 KB Correct solution.
3 Correct 5 ms 8276 KB Correct solution.
4 Correct 5 ms 8148 KB Correct solution.
5 Correct 4 ms 8152 KB Correct solution.
6 Correct 5 ms 8168 KB Correct solution.
7 Correct 5 ms 8276 KB Correct solution.
8 Correct 5 ms 8148 KB Correct solution.
9 Incorrect 5 ms 8160 KB Participant's answer is Lose, but jury's is Draw.
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8148 KB Correct solution.
2 Incorrect 4 ms 8148 KB Participant's answer is Lose, but jury's is Draw.
3 Halted 0 ms 0 KB -