답안 #1009607

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1009607 2024-06-27T16:53:58 Z aaaaaarroz 늑대인간 (IOI18_werewolf) C++17
15 / 100
4000 ms 31612 KB
#include <bits/stdc++.h>
    using namespace std;
     
    #define all(x) x.begin(),x.end()
     
     
    std::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 n = N;
        vector<vector<int>> adj(n);
        for(int i=0;i<X.size();i++){
            adj[X[i]].emplace_back(Y[i]);
            adj[Y[i]].emplace_back(X[i]);
        }
        vector<int> ans(S.size());
        for(int i=0;i<S.size();i++){
            priority_queue<pair<int,int>> q;
            vector<int> dists(n,-1);
            q.emplace(S[i],S[i]);
            vector<bool> visited(n);
            while(!q.empty()){
                auto [dist,idx]=q.top();q.pop();
                if(visited[idx])continue;
                visited[idx]=true;
                dists[idx] = dist;
                for(int&x:adj[idx])if(!visited[x])q.emplace(min(x,dist),x);
            }
            vector<int> diste(n,n);
            visited = vector<bool>(n);
            q.emplace(-E[i],E[i]);
            while(!q.empty()){
                auto [dist,idx]=q.top();q.pop();dist=-dist;
                if(visited[idx])continue;
                visited[idx]=true;
                diste[idx] = dist;
                for(int&x:adj[idx])if(!visited[x])q.emplace(-max(x,dist),x);
            }
            for(int x=0;x<n;x++)if(dists[x]>=L[i] and diste[x]<=R[i])ans[i]=1;
        }
        return ans;
    }

Compilation message

werewolf.cpp: In function 'std::vector<int> check_validity(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:12:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |         for(int i=0;i<X.size();i++){
      |                     ~^~~~~~~~~
werewolf.cpp:17:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for(int i=0;i<S.size();i++){
      |                     ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 452 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 452 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1554 ms 884 KB Output is correct
11 Correct 1254 ms 856 KB Output is correct
12 Correct 464 ms 856 KB Output is correct
13 Correct 1407 ms 856 KB Output is correct
14 Correct 990 ms 856 KB Output is correct
15 Correct 3041 ms 984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4029 ms 31612 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 452 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1554 ms 884 KB Output is correct
11 Correct 1254 ms 856 KB Output is correct
12 Correct 464 ms 856 KB Output is correct
13 Correct 1407 ms 856 KB Output is correct
14 Correct 990 ms 856 KB Output is correct
15 Correct 3041 ms 984 KB Output is correct
16 Execution timed out 4029 ms 31612 KB Time limit exceeded
17 Halted 0 ms 0 KB -