Language: C++

#include <iostream>
#include <queue>
#include <vector>
using namespace std;

#define INF 1e+9
#define MAX_V 10

struct edge {
    int to;
    int cost;
};

// <最短距離, 頂点の番号>
using P = pair<int, int>;

int V;
vector<edge> G[MAX_V];
int d[MAX_V];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    cin >> V;
    int E;
    cin >> E;
    for (int i=0; i<E; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        edge e = {b, c};
        G[a].push_back(e);
    }
    dijkstra(0);
    for (int i=0; i<V; ++i) {
        if(d[i] != INF)
            cout << "0から" << i << "までのコスト: " << d[i] << endl;
    }
}
#include<bits/stdc++.h>
using namespace std;
int n,m,r;
vector<int> r;
vector<vector<int>> ab,R;
vector<bool> edge;
int main(){
  cin>>n>>m>>rr;
  r.resize(rr);
  R.resize(rr);
  for(int i=0;i<rr;i++){
    R.resize(rr);
    cin>>r[i];
    r[i]--;
  }
  memset(R,10000000,sizeof R);
  ab.resize(n);
  for(int i=0;i<n;i++){
    ab[i].resize(n);
  }
  memset(ab,10000000,sizeof ab);
  for(int i=0;i<m;i++){
    int a,b,c;
    cin>>a>>b>>c;
    a--,b--;
    ab[a][b]=c;
    ab[b][a]=c;
  }
  for(int i=0;i<rr;i++){
    for(int j=i+1;j<rr;j++){
      

Compiler output:
a.cc:62:13: error: conflicting declaration 'std::vector<int> r'
   62 | vector<int> r;
      |             ^
a.cc:61:9: note: previous declaration as 'int r'
   61 | int n,m,r;
      |         ^
a.cc:65:5: error: redefinition of 'int main()'
   65 | int main(){
      |     ^~~~
a.cc:43:5: note: 'int main()' previously defined here
   43 | int main() {
      |     ^~~~
a.cc: In function 'int main()':
a.cc:66:14: error: 'rr' was not declared in this scope; did you mean 'r'?
   66 |   cin>>n>>m>>rr;
      |              ^~
      |              r
a.cc:67:5: error: request for member 'resize' in 'r', which is of non-class type 'int'
   67 |   r.resize(rr);
      |     ^~~~~~
a.cc:71:11: error: invalid types 'int[int]' for array subscript
   71 |     cin>>r[i];
      |           ^
a.cc:72:6: error: invalid types 'int[int]' for array subscript
   72 |     r[i]--;
      |      ^
a.cc:74:10: error: cannot convert 'std::vector<std::vector<int> >' to 'void*'
   74 |   memset(R,10000000,sizeof R);
      |          ^
      |          |
      |          std::vector<std::vector<int> >
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:59:
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
a.cc:79:10: error: cannot convert 'std::vector<std::vector<int> >' to 'void*'
   79 |   memset(ab,10000000,sizeof ab);
      |          ^~
      |          |
      |          std::vector<std::vector<int> >
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
a.cc:88:29: error: expected '}' at end of input
   88 |     for(int j=i+1;j<rr;j++){
      |                            ~^
a.cc:88:29: error: expected '}' at end of input
a.cc:87:24: note: to match this '{'
   87 |   for(int i=0;i<rr;i++){
      |                        ^
a.cc:88:29: error: expected '}' at end of input
   88 |     for(int j=i+1;j<rr;j++){
      |                             ^
a.cc:65:11: note: to match this '{'
   65 | int main(){
      |           ^