Submission #731819

# Submission time Handle Problem Language Result Execution time Memory
731819 2023-04-28T03:54:00 Z Trunkty Hotspot (NOI17_hotspot) C++14
0 / 100
8 ms 8916 KB
#include <bits/extc++.h>
using namespace std;
typedef long long ll;
#define int ll

int n,m;
vector<int> roads[5005];
int best[5005][5005],cnt[5005][5005];

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    cin >> n >> m;
    for(int i=1;i<=m;i++){
        int a,b;
        cin >> a >> b;
        roads[a].push_back(b);
        roads[b].push_back(a);
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            best[i][j] = 2000000000;
        }
        vector<int> v = {i};
        best[i][i] = 0;
        cnt[i][i] = 1;
        for(int j=0;j<v.size();j++){
            int x = v[j];
            for(int k:roads[x]){
                if(best[i][k]==best[i][x]+1){
                    cnt[i][k] += cnt[i][x];
                }
                else if(best[i][k]>best[i][x]+1){
                    best[i][k] = best[i][x]+1;
                    cnt[i][k] = cnt[i][x];
                    v.push_back(k);
                }
            }
        }
    }
    cout << cnt[1][3] << "\n";
	return 0;
}

Compilation message

hotspot.cpp: In function 'int main()':
hotspot.cpp:27:22: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         for(int j=0;j<v.size();j++){
      |                     ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 8916 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 8916 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 8916 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 8916 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 8916 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 8916 KB Output isn't correct
2 Halted 0 ms 0 KB -