제출 #1361223

#제출 시각아이디문제언어결과실행 시간메모리
1361223takoshanava경주 (Race) (IOI11_race)C++20
컴파일 에러
0 ms0 KiB
#include "race.h"
#include <bits/stdc++.h>
#define pb push_back
#define fs first
#define sc second

const int N = 2e5 + 5;
vector<pair<int, int>> adj[N];
map<pair<int, int>, int> d;
int sz[N], dist[N], fix[N], pr[N], n, cent;
map<int, int> ds;
vector<int> vec;

void dfs1(int v, int par){
    pr[v] = par;
    sz[v] = 1;
    for(auto u:adj[v]){
        if(u != par and !fix[u]) dfs(u, v);
        sz[v] += sz[u];
    }
}

void dfs2(int v, int par){
    dist[v] = dist[par] + d[{par, v}]
    if(v == cent) dist[v] = 0;
    ds[dist[v]]++;
    vec.pb(dist[v])
    for(auto u:adj[v]){
        if(u != par and !fix[u]) dfs(u, v);
    }
}

int solve(int v){
    dfs1(v, pr[v]);
    for(int i = 0; i < n; i++){
        bool ok = 1;
        for(auto u:adj[i]){
            if(sz[u] > n / 2) ok = 0;
        }
        if(ok){
            cent = i;
            break;
        }
    }
    ds.clear();
    dfs2(cent, par[cent]);
    for()
}

int best_path(int nn, int k, int h[][2], int l[]){
    n = nn;
    for(int i = 0; i < n; i++){
        int a = h[i][1], b = h[i][0], w = l[i];
        adj[a].pb(b); adj[b].pb(a);
        d[{a, b}] = d[{b, a}] = w; 
    }
}
//dasamtavrebeli

컴파일 시 표준 에러 (stderr) 메시지

race.cpp:8:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    8 | vector<pair<int, int>> adj[N];
      |        ^~~~
      |        std::pair
In file included from /usr/include/c++/13/bits/stl_algobase.h:64,
                 from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from race.cpp:2:
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:8:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    8 | vector<pair<int, int>> adj[N];
      |        ^~~~
      |        std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:8:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    8 | vector<pair<int, int>> adj[N];
      |        ^~~~
      |        std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:8:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    8 | vector<pair<int, int>> adj[N];
      |        ^~~~
      |        std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:8:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    8 | vector<pair<int, int>> adj[N];
      |        ^~~~
      |        std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:8:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    8 | vector<pair<int, int>> adj[N];
      |        ^~~~
      |        std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:8:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    8 | vector<pair<int, int>> adj[N];
      |        ^~~~
      |        std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:8:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    8 | vector<pair<int, int>> adj[N];
      |        ^~~~
      |        std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:8:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    8 | vector<pair<int, int>> adj[N];
      |        ^~~~
      |        std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:8:1: error: 'vector' does not name a type
    8 | vector<pair<int, int>> adj[N];
      | ^~~~~~
race.cpp:9:5: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    9 | map<pair<int, int>, int> d;
      |     ^~~~
      |     std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:9:5: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    9 | map<pair<int, int>, int> d;
      |     ^~~~
      |     std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:9:5: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    9 | map<pair<int, int>, int> d;
      |     ^~~~
      |     std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:9:5: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    9 | map<pair<int, int>, int> d;
      |     ^~~~
      |     std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:9:5: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    9 | map<pair<int, int>, int> d;
      |     ^~~~
      |     std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:9:5: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    9 | map<pair<int, int>, int> d;
      |     ^~~~
      |     std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:9:5: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    9 | map<pair<int, int>, int> d;
      |     ^~~~
      |     std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:9:5: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    9 | map<pair<int, int>, int> d;
      |     ^~~~
      |     std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:9:5: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    9 | map<pair<int, int>, int> d;
      |     ^~~~
      |     std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
race.cpp:9:1: error: 'map' does not name a type
    9 | map<pair<int, int>, int> d;
      | ^~~
race.cpp:11:1: error: 'map' does not name a type
   11 | map<int, int> ds;
      | ^~~
race.cpp:12:1: error: 'vector' does not name a type
   12 | vector<int> vec;
      | ^~~~~~
race.cpp: In function 'void dfs1(int, int)':
race.cpp:17:16: error: 'adj' was not declared in this scope
   17 |     for(auto u:adj[v]){
      |                ^~~
race.cpp:18:34: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   18 |         if(u != par and !fix[u]) dfs(u, v);
      |                                  ^~~
      |                                  ffs
race.cpp: In function 'void dfs2(int, int)':
race.cpp:24:27: error: 'd' was not declared in this scope
   24 |     dist[v] = dist[par] + d[{par, v}]
      |                           ^
race.cpp:26:5: error: 'ds' was not declared in this scope; did you mean 'fs'?
   26 |     ds[dist[v]]++;
      |     ^~
      |     fs
race.cpp:27:5: error: 'vec' was not declared in this scope
   27 |     vec.pb(dist[v])
      |     ^~~
race.cpp: In function 'int solve(int)':
race.cpp:37:20: error: 'adj' was not declared in this scope
   37 |         for(auto u:adj[i]){
      |                    ^~~
race.cpp:45:5: error: 'ds' was not declared in this scope; did you mean 'fs'?
   45 |     ds.clear();
      |     ^~
      |     fs
race.cpp:46:16: error: 'par' was not declared in this scope; did you mean '__pstl::execution::v1::par'?
   46 |     dfs2(cent, par[cent]);
      |                ^~~
      |                __pstl::execution::v1::par
In file included from /usr/include/c++/13/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/13/algorithm:73:
/usr/include/c++/13/pstl/execution_defs.h:111:45: note: '__pstl::execution::v1::par' declared here
  111 | _GLIBCXX17_INLINE constexpr parallel_policy par{};
      |                                             ^~~
race.cpp:47:9: error: expected primary-expression before ')' token
   47 |     for()
      |         ^
race.cpp:48:1: error: expected primary-expression before '}' token
   48 | }
      | ^
race.cpp:47:10: error: expected ';' before '}' token
   47 |     for()
      |          ^
      |          ;
   48 | }
      | ~         
race.cpp:48:1: error: expected primary-expression before '}' token
   48 | }
      | ^
race.cpp:47:10: error: expected ')' before '}' token
   47 |     for()
      |        ~ ^
      |          )
   48 | }
      | ~         
race.cpp:48:1: error: expected primary-expression before '}' token
   48 | }
      | ^
race.cpp:48:1: warning: no return statement in function returning non-void [-Wreturn-type]
race.cpp: In function 'int best_path(int, int, int (*)[2], int*)':
race.cpp:54:9: error: 'adj' was not declared in this scope
   54 |         adj[a].pb(b); adj[b].pb(a);
      |         ^~~
race.cpp:55:9: error: 'd' was not declared in this scope
   55 |         d[{a, b}] = d[{b, a}] = w;
      |         ^
race.cpp:57:1: warning: no return statement in function returning non-void [-Wreturn-type]
   57 | }
      | ^