Submission #603204

# Submission time Handle Problem Language Result Execution time Memory
603204 2022-07-23T17:03:55 Z Ahmadsm2005 Event Hopping (BOI22_events) C++17
0 / 100
187 ms 199172 KB
#include <bits/stdc++.h>
//#define int long long
using namespace std;
int N,Q,S[5001],E[5001],X,Y;
vector<int>ADJ[5001];
bool VIS[5001];
int DIST[5001][5001];
void BFS(int x){
for(int i = 0;i < N; i += 1)VIS[i] = 0;
queue<pair<int,int>>Q;
Q.push({x,0});
DIST[x][x] = 0;
VIS[x] = 1;
while(Q.size()){
    int V = Q.front().first, S = Q.front().second;
    Q.pop();
    for(int i = 0; i <ADJ[V].size(); i += 1){
        if(!VIS[ADJ[V][i]])
            Q.push({ADJ[V][i], S + 1}),VIS[ADJ[V][i]] = 1,DIST[x][ADJ[V][i]] = S + 1;
    }
}
}
int32_t main()
{
    cin.tie(0),iostream::sync_with_stdio(0);
    cin>>N>>Q;
    for(int i = 0; i < N; i += 1)for(int l = 0; l < N; l += 1)DIST[i][l] = -1;
    for(int i = 0; i < N; i += 1){
        cin>>S[i]>>E[i];
    }
    while(Q--){
        cin>>X>>Y;
        X--,Y--;
        if(X == Y)cout<<0;
        else if(S[Y] <= E[X]&&E[X] <= E[Y])cout<<1;
        else
        cout<<"impossible";
        cout<<'\n';
    }
}

Compilation message

events.cpp: In function 'void BFS(int)':
events.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 <ADJ[V].size(); i += 1){
      |                    ~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 187 ms 199172 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -