답안 #253330

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
253330 2020-07-27T18:20:53 Z mamadmokhi Planinarenje (COCI18_planinarenje) C++17
160 / 160
11 ms 896 KB
    // In the name of Allah
    // There is no power but from God the Almighty
    // No God except Allah
    #include <bits/stdc++.h>
    #define mp make_pair
    #define f1 first
    #define f2 second
    #define pb push_back
    #define pii pair<int ,int>
    #define ios  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    const int mox=5e3+9;
    vector<int> v[2*mox];
    bool visit[2*mox];
    int mach[2*mox];
    bool win[mox];
    bool dfs(int x)
    {
       if(visit[x])
         return 0;
         visit[x]=1;
         win[x]=1;
         for(int i:v[x])
         {
             if(mach[i]==0||dfs(mach[i]))
               {
                 mach[i]=x;
                 mach[x]=i;
                 return 1;
               }
         }
         return 0;
    }
    int32_t main()
    {
       ios
        int n,m;
        cin>>n>>m;
        for(int i=0 ; i<m ; i++)
        {
          int a,b;
          cin>>a>>b;
          v[a].pb(b+n);
        }
        for(int i=1 ; i<=n ; i++)
        {
           dfs(i);
           memset(visit,0,sizeof(visit));
        }
        memset(win,0,sizeof(win));
      for(int i=1 ; i<=n ; i++)
      {
         if(mach[i]==0)
         {
           dfs(i);
           memset(visit,0,sizeof(visit));
         }
      }
      for(int i=1 ; i<=n ; i++)
      {
         if(win[i])
         {
           cout<<"Mirko"<<'\n';
         }
         else
         cout<<"Slavko"<<'\n';
      }
    }

Compilation message

planinarenje.cpp: In function 'bool dfs(int)':
planinarenje.cpp:19:8: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
        if(visit[x])
        ^~
planinarenje.cpp:21:10: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
          visit[x]=1;
          ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 640 KB Output is correct
2 Correct 0 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 640 KB Output is correct
2 Correct 1 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 640 KB Output is correct
2 Correct 0 ms 640 KB Output is correct
3 Correct 0 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 640 KB Output is correct
2 Correct 1 ms 640 KB Output is correct
3 Correct 1 ms 640 KB Output is correct
4 Correct 1 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 896 KB Output is correct
2 Correct 5 ms 896 KB Output is correct
3 Correct 4 ms 896 KB Output is correct
4 Correct 4 ms 896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 2 ms 768 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 3 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 768 KB Output is correct
2 Correct 7 ms 768 KB Output is correct
3 Correct 3 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 768 KB Output is correct
2 Correct 4 ms 768 KB Output is correct
3 Correct 2 ms 768 KB Output is correct
4 Correct 3 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 764 KB Output is correct
2 Correct 3 ms 768 KB Output is correct
3 Correct 4 ms 768 KB Output is correct
4 Correct 3 ms 768 KB Output is correct