Advertisement
Norvager

Untitled

Feb 16th, 2019
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #define Inf 1000*1000*1000
  3. #include <vector>
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. vector <vector <pair<int, int>>> line;
  8. vector <int> timer, answer;
  9. vector <bool> used;
  10.  
  11. int main()
  12. {
  13. #ifndef ONLINE_JUDGE
  14. freopen("input.txt", "r", stdin);
  15. #endif // !ONLINE_JUDGE
  16.  
  17. int N, M, ans = 0;
  18. scanf("%d %d", &N, &M);
  19. line.resize(N + 1, vector<pair<int, int>>(N + 1, pair<int, int> (-1, -1)));
  20. timer.resize(N + 1, 0);
  21. answer.resize(N + 1, 0);
  22. used.resize(N + 1, false);
  23. int a, b, c;
  24. long long d;
  25. for (int i = 1; i <= M; i++)
  26. {
  27. scanf("%d %d %d %lli", &a, &b, &c, &d);
  28. d -= 3'000'000;
  29. if (d < 100) continue;
  30. d /= 100;
  31. line[a][b] = make_pair(c, d);
  32. line[b][a] = make_pair(c, d);
  33. }
  34. timer[1] = answer[1] = 0;
  35. used[1] = true;
  36.  
  37. for (int i = 0; i <= N; i++)
  38. {
  39. int cur = 0;
  40. for (int j = 0; j <= N; j++)
  41. if (!used[j] && (cur == 0 || answer[j] < answer[cur]))
  42. cur = j;
  43. if (answer[cur] == Inf)
  44. break;
  45. used[cur] = true;
  46.  
  47. for (int j = 1; j <= N; j++)
  48. {
  49. int t = line[cur][j].first, p = line[cur][j].second;
  50. if (timer[j] + t < 1440 && )
  51. j++;
  52. }
  53. }
  54.  
  55.  
  56. printf("%d", ans);
  57. return 0;
  58. }
  59.  
  60. // for (int j = 1; j <= N; j++)
  61. // {
  62. // int way = line[min_ind][j];
  63. // if (answer[min_ind] + way < answer[j] && way != -1)
  64. // {
  65. // answer[j] = answer[min_ind] + way;
  66. // }
  67. // }
  68. //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement