Submission #1088337

# Submission time Handle Problem Language Result Execution time Memory
1088337 2024-09-14T09:09:45 Z Rolo678 Aesthetic (NOI20_aesthetic) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<vector<,pair<int,int>>>g(3e5+5);
vector<long long>dp2(3e5+5,-1);
 vector<long long>dp(3e5+5,-1);

signed main()
{
  int n,m;
  cin >> n>>m;
 // cin >> n >> m;
  vector<long long>mx(m+2);
  for(int i = 1;i<=m;i++)
  {
    int a,b,w;
    cin >> a >> b >> w;
    //cout << 'o';
    g[a].push_back({b,i});
    g[b].push_back({a,i});
    mx[i] = w;
//cout << 'o';
  }
 
  for(int i = n-1;i> 0;i--)
  {
    mx[i] = max(mx[i+1],mx[i]);
  }
 
  //dfs();
  dp[1] =0;
  queue<int>q;
  q.push_back(1);
  while(!q.empty())
  {
    v = q.top();
    q.pop();
    for(auto i : g[v])
    {
      if(dp[u] == -1)
      {
        q.push(u);
        dp[u] = dp[v] + 1;
      }
    }
  }
    dp2[n] =0;
  queue<int>q;
  q.push_back(n);
  while(!q.empty())
  {
    v = q.top();
    q.pop();
    for(auto i : g[v])
    {
      if(dp2[u] == -1)
      {
        q.push(u);
        dp2[u] = dp2[v] + 1;
      }
    }
  }
  int ans = 0;
  cout << ans;
}

Compilation message

Aesthetic.cpp:4:28: error: template argument 1 is invalid
    4 | vector<vector<,pair<int,int>>>g(3e5+5);
      |                            ^~
Aesthetic.cpp:4:30: error: template argument 1 is invalid
    4 | vector<vector<,pair<int,int>>>g(3e5+5);
      |                              ^
Aesthetic.cpp:4:30: error: template argument 2 is invalid
Aesthetic.cpp: In function 'int main()':
Aesthetic.cpp:19:6: error: invalid types 'int[long long int]' for array subscript
   19 |     g[a].push_back({b,i});
      |      ^
Aesthetic.cpp:20:6: error: invalid types 'int[long long int]' for array subscript
   20 |     g[b].push_back({a,i});
      |      ^
Aesthetic.cpp:33:5: error: 'class std::queue<long long int>' has no member named 'push_back'
   33 |   q.push_back(1);
      |     ^~~~~~~~~
Aesthetic.cpp:36:5: error: 'v' was not declared in this scope
   36 |     v = q.top();
      |     ^
Aesthetic.cpp:36:11: error: 'class std::queue<long long int>' has no member named 'top'; did you mean 'pop'?
   36 |     v = q.top();
      |           ^~~
      |           pop
Aesthetic.cpp:40:13: error: 'u' was not declared in this scope
   40 |       if(dp[u] == -1)
      |             ^
Aesthetic.cpp:48:13: error: redeclaration of 'std::queue<long long int> q'
   48 |   queue<int>q;
      |             ^
Aesthetic.cpp:32:13: note: 'std::queue<long long int> q' previously declared here
   32 |   queue<int>q;
      |             ^
Aesthetic.cpp:49:5: error: 'class std::queue<long long int>' has no member named 'push_back'
   49 |   q.push_back(n);
      |     ^~~~~~~~~
Aesthetic.cpp:52:5: error: 'v' was not declared in this scope
   52 |     v = q.top();
      |     ^
Aesthetic.cpp:52:11: error: 'class std::queue<long long int>' has no member named 'top'; did you mean 'pop'?
   52 |     v = q.top();
      |           ^~~
      |           pop
Aesthetic.cpp:56:14: error: 'u' was not declared in this scope
   56 |       if(dp2[u] == -1)
      |              ^