답안 #819654

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
819654 2023-08-10T12:26:23 Z Trumling 늑대인간 (IOI18_werewolf) C++14
0 / 100
4000 ms 21360 KB
#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std; 

typedef long long ll;
#define pb push_back
#define F first
#define S second
#define enter cout<<'\n';
#define INF 99999999999999999
#define MOD 1000000007
#define all(x) x.begin(),x.end()

vector<int> check_validity(int n, std::vector<int> x, std::vector<int> y,
                                std::vector<int> S, std::vector<int> E,
                                std::vector<int> L, std::vector<int> R) {
  int Q = S.size();
  ll m=x.size();

  vector<vector<int>>g(n);

  for(int i=0;i<m;i++)
  {
    g[x[i]].pb(y[i]);
    g[y[i]].pb(x[i]);
  }
  vector<int>ans;
  for(int i=0;i<Q;i++)
  {
    vector<vector<bool>>vis(2,vector<bool>(n,0));
    vis[0][S[i]]=1;
    if(S[i]<=R[i])
    vis[1][S[i]]=1;

    set<int>q;
    q.insert(S[i]);
    while(!q.empty())
    {
      ll curr=*q.begin();
      q.erase(curr);

      for(auto x:g[curr])
      {
        if(vis[0][curr] && !vis[0][x] &&  x>=L[i])
        {
          vis[0][x]=1;
          q.insert(x);
        }

        if((vis[1][curr] || (vis[0][curr] && curr<=R[i])) && !vis[1][x] && x<=R[i])
        {
          vis[1][x]=1;
          q.insert(x);
        }
      }
    }
    ans.pb(vis[1][E[i]]);
  }
  return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 312 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 312 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4051 ms 21360 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 312 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -