Submission #587498

#TimeUsernameProblemLanguageResultExecution timeMemory
587498LastRoninRail (IOI14_rail)C++14
Compilation error
0 ms0 KiB
#include "rail.h" #include<bits/stdc++.h> using namespace std; /* typedef struct Station { int index; int type; int location; int L,R; }STATION; long long cnt; static int S,SUBTASK; static STATION stations[10004]; int cmp_fun_1(const void *a,const void *b) { STATION c,d; c = *(STATION*)(a); d = *(STATION*)(b); return c.location < d.location ? -1 : 1; } int cmp_fun_2(const void *a,const void *b) { STATION c,d; c = *(STATION*)(a); d = *(STATION*)(b); return c.index < d.index ? -1 : 1; } void now_I_want_to_getLR(){ int now = stations[S-1].index,i; for(i=S-2;i>=0;i--){ stations[i].R = now; if(stations[i].type==2) now = stations[i].index; } now = stations[0].index; for(i=1;i<S;i++){ stations[i].L = now; if(stations[i].type==1) now = stations[i].index; } } int getDistance(int x,int y) { cnt++; if(x==y) return 0; if(x<0 || x>=S || y<0 || y>=S) return -1; if(stations[x].location > stations[y].location){ int tmp = x; x = y; y = tmp; } int ret = 0; if(stations[x].type==1 && stations[y].type==1){ ret = stations[stations[y].R].location-stations[x].location+stations[stations[y].R].location-stations[y].location; }else if(stations[x].type==1 && stations[y].type==2){ ret = stations[y].location-stations[x].location; }else if(stations[x].type==2 && stations[y].type==2){ ret = stations[x].location-stations[stations[x].L].location+stations[y].location-stations[stations[x].L].location; }else if(stations[x].type==2 && stations[y].type==1){ ret = stations[x].location-stations[stations[x].L].location+stations[stations[y].R].location -stations[stations[x].L].location+stations[stations[y].R].location-stations[y].location; } return ret; } void getInput() { int g; g = scanf("%d",&SUBTASK); g = scanf("%d",&S); int s; for (s = 0; s < S; s++) { int type, location; g = scanf(" %d %d",&type,&location); stations[s].index = s; stations[s].location = location; stations[s].type = type; stations[s].L = -1; stations[s].R = -1; } qsort(stations, S, sizeof(STATION), cmp_fun_1); now_I_want_to_getLR(); qsort(stations, S, sizeof(STATION), cmp_fun_2); } int serverGetStationNumber() { return S; } int serverGetSubtaskNumber() { return SUBTASK; } int serverGetFirstStationLocation() { return stations[0].location; } /**/ const int N = 5e3 + 100; int cont = 0; bool le[N]; int dist[N][N]; bool was[N][N]; int get(int a, int b) { if(was[a][b])return dist[a][b]; cont++; was[a][b] = 1; dist[a][b] = getDistance(a, b); return dist[a][b]; } void findLocation(int n, int first, int location[], int stype[]) { location[0] = first; stype[0] = 1; vector<pair<int, int>> z; for(int i = 1; i < n; i++) { dist[0][i] = get(0, i); was[0][i] = 1; z.pb(mp(dist[0][i], i)); } sort(z.begin(), z.end()); ll L = first, Lid = 0; ll R = first + z[0].f, Rid = z[0].s; location[Rid] = R; stype[Rid] = R; vector<int> C, D; C.pb(Lid); D.pb(Rid); for(int j = 1; j < n - 1; j++) { if(Lid == 0) { ll a = z[j].f; ll b = get(Rid, z[j].s); ll pos = R - b; ll pos1 = R - b;// type C ll pos2 = L + a;// type D ll ind = -1, bliz = 1e9; for(int j = 0; j < D.size(); j++) { if(location[D[j]] > pos1) { if(bliz > location[D[j]]) { bliz = location[D[j]]; ind = j; } } } if(ind == Rid) { if((R - L) + b == a) { location[z[j].s] = pos1; stype[z[j].s] = 1; C.pb(z[j].s); if(pos1 < L) L = pos1, Lid = z[j].s; } else { location[z[j].s] = pos2; stype[z[j].s] = 2; D.pb(z[j].s); if(pos2 > R) R = pos2, Rid = z[j].s; } } else { assert(ind != -1); ll di = get(ind, z[j].s); if(di + dist[0][ind] == dist[0][z[j].s]) { location[z[j].s] = pos1; stype[z[j].s] = 1; C.pb(z[j].s); if(pos1 < L) L = pos1, Lid = z[j].s; } else { location[z[j].s] = pos2; stype[z[j].s] = 2; D.pb(z[j].s); if(pos2 > R) R = pos2, Rid = z[j].s; } } } else { ll d1 = get(Lid, z[j].s); ll d2 = get(Rid, z[j].s); ll pos1 = L + d1;// type D ll pos2 = R - d2;// type C bool c = 0; if(pos1 < R) { for(auto u : C) { if(location[u] < pos1 && (pos1 - location[u]) + (R - location[u]) == d2) c = 1; } if(c) { location[z[j].s] = pos1; stype[z[j].s] = 2; D.pb(z[j].s); continue; } else { location[z[j].s] = pos2; stype[z[j].s] = 1; C.pb(z[j].s); continue; } } if(pos2 > L) { for(auto u : D) { if(location[u] > pos2 && (location[u] - pos2) + (location[u] - L) == d1) c = 1; } if(c) { location[z[j].s] = pos2; stype[z[j].s] = 1; C.pb(z[j].s); continue; } else { location[z[j].s] = pos1; stype[z[j].s] = 2; D.pb(z[j].s); continue; } } if(location[0] - L + dist[0][z[j].s] == d1) { if(d1 - (location[z[0].s] - L) + (R - location[z[0].s]) == d2) { location[z[j].s] = pos1; stype[z[j].s] = 2; D.pb(z[j].s); } else { location[z[j].s] = pos2; stype[z[j].s] = 1; C.pb(z[j].s); } } else { location[z[j].s] = pos2; stype[z[j].s] = 1; C.pb(z[j].s); continue; } } } assert(cont <= n * (n - 1)/2); } /* int main() { int i; getInput(); cnt = 0; int location[10005]; int type[10005]; int ok = 1; findLocation(S, serverGetFirstStationLocation(),location, type); if(SUBTASK==3 && cnt>S*(S-1)) ok = 0; if(SUBTASK==4 && cnt>3*(S-1)) ok = 0; for (i = 0; i < S; i++) if(type[i]!=stations[i].type || location[i]!=stations[i].location) ok = 0; if(ok==0) printf("Incorrect"); else printf("Correct"); return 0; } /* 3 6 1 3 2 4 1 1 2 2 1 5 2 6 */

Compilation message (stderr)

rail.cpp:103:1: warning: "/*" within comment [-Wcomment]
  103 | /**/
      |  
rail.cpp:268:1: warning: "/*" within comment [-Wcomment]
  268 | /*
      |  
rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:127:5: error: 'class std::vector<std::pair<int, int> >' has no member named 'pb'
  127 |   z.pb(mp(dist[0][i], i));
      |     ^~
rail.cpp:127:8: error: 'mp' was not declared in this scope
  127 |   z.pb(mp(dist[0][i], i));
      |        ^~
rail.cpp:130:2: error: 'll' was not declared in this scope; did you mean 'le'?
  130 |  ll L = first, Lid = 0;
      |  ^~
      |  le
rail.cpp:131:4: error: expected ';' before 'R'
  131 |  ll R = first + z[0].f, Rid = z[0].s;
      |    ^~
      |    ;
rail.cpp:132:11: error: 'Rid' was not declared in this scope
  132 |  location[Rid] = R;
      |           ^~~
rail.cpp:132:18: error: 'R' was not declared in this scope
  132 |  location[Rid] = R;
      |                  ^
rail.cpp:135:4: error: 'class std::vector<int>' has no member named 'pb'
  135 |  C.pb(Lid);
      |    ^~
rail.cpp:135:7: error: 'Lid' was not declared in this scope
  135 |  C.pb(Lid);
      |       ^~~
rail.cpp:136:4: error: 'class std::vector<int>' has no member named 'pb'
  136 |  D.pb(Rid);
      |    ^~
rail.cpp:139:6: error: expected ';' before 'a'
  139 |    ll a = z[j].f;
      |      ^~
      |      ;
rail.cpp:140:6: error: expected ';' before 'b'
  140 |    ll b = get(Rid, z[j].s);
      |      ^~
      |      ;
rail.cpp:141:6: error: expected ';' before 'pos'
  141 |    ll pos = R - b;
      |      ^~~~
      |      ;
rail.cpp:142:6: error: expected ';' before 'pos1'
  142 |    ll pos1 = R - b;// type C
      |      ^~~~~
      |      ;
rail.cpp:143:6: error: expected ';' before 'pos2'
  143 |    ll pos2 = L + a;// type D
      |      ^~~~~
      |      ;
rail.cpp:144:6: error: expected ';' before 'ind'
  144 |    ll ind = -1, bliz = 1e9;
      |      ^~~~
      |      ;
rail.cpp:145:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  145 |    for(int j = 0; j < D.size(); j++) {
      |                   ~~^~~~~~~~~~
rail.cpp:146:25: error: 'pos1' was not declared in this scope
  146 |     if(location[D[j]] > pos1) {
      |                         ^~~~
rail.cpp:147:9: error: 'bliz' was not declared in this scope
  147 |      if(bliz > location[D[j]]) {
      |         ^~~~
rail.cpp:149:7: error: 'ind' was not declared in this scope; did you mean 'int'?
  149 |       ind = j;
      |       ^~~
      |       int
rail.cpp:153:7: error: 'ind' was not declared in this scope; did you mean 'int'?
  153 |    if(ind == Rid) {
      |       ^~~
      |       int
rail.cpp:154:13: error: 'L' was not declared in this scope
  154 |     if((R - L) + b == a) {
      |             ^
rail.cpp:154:18: error: 'b' was not declared in this scope
  154 |     if((R - L) + b == a) {
      |                  ^
rail.cpp:154:23: error: 'a' was not declared in this scope
  154 |     if((R - L) + b == a) {
      |                       ^
rail.cpp:155:20: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  155 |      location[z[j].s] = pos1;
      |                    ^
rail.cpp:155:25: error: 'pos1' was not declared in this scope
  155 |      location[z[j].s] = pos1;
      |                         ^~~~
rail.cpp:156:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  156 |      stype[z[j].s] = 1;
      |                 ^
rail.cpp:157:8: error: 'class std::vector<int>' has no member named 'pb'
  157 |      C.pb(z[j].s);
      |        ^~
rail.cpp:157:16: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  157 |      C.pb(z[j].s);
      |                ^
rail.cpp:159:28: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  159 |       L = pos1, Lid = z[j].s;
      |                            ^
rail.cpp:161:20: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  161 |      location[z[j].s] = pos2;
      |                    ^
rail.cpp:161:25: error: 'pos2' was not declared in this scope
  161 |      location[z[j].s] = pos2;
      |                         ^~~~
rail.cpp:162:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  162 |      stype[z[j].s] = 2;
      |                 ^
rail.cpp:163:8: error: 'class std::vector<int>' has no member named 'pb'
  163 |      D.pb(z[j].s);
      |        ^~
rail.cpp:163:16: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  163 |      D.pb(z[j].s);
      |                ^
rail.cpp:165:28: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  165 |       R = pos2, Rid = z[j].s;
      |                            ^
rail.cpp:170:7: error: expected ';' before 'di'
  170 |     ll di = get(ind, z[j].s);
      |       ^~~
      |       ;
rail.cpp:171:8: error: 'di' was not declared in this scope; did you mean 'div'?
  171 |     if(di + dist[0][ind] == dist[0][z[j].s]) {
      |        ^~
      |        div
rail.cpp:171:42: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  171 |     if(di + dist[0][ind] == dist[0][z[j].s]) {
      |                                          ^
rail.cpp:172:20: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  172 |      location[z[j].s] = pos1;
      |                    ^
rail.cpp:172:25: error: 'pos1' was not declared in this scope
  172 |      location[z[j].s] = pos1;
      |                         ^~~~
rail.cpp:173:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  173 |      stype[z[j].s] = 1;
      |                 ^
rail.cpp:174:8: error: 'class std::vector<int>' has no member named 'pb'
  174 |      C.pb(z[j].s);
      |        ^~
rail.cpp:174:16: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  174 |      C.pb(z[j].s);
      |                ^
rail.cpp:175:16: error: 'L' was not declared in this scope
  175 |      if(pos1 < L)
      |                ^
rail.cpp:176:28: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  176 |       L = pos1, Lid = z[j].s;
      |                            ^
rail.cpp:178:20: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  178 |      location[z[j].s] = pos2;
      |                    ^
rail.cpp:178:25: error: 'pos2' was not declared in this scope
  178 |      location[z[j].s] = pos2;
      |                         ^~~~
rail.cpp:179:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  179 |      stype[z[j].s] = 2;
      |                 ^
rail.cpp:180:8: error: 'class std::vector<int>' has no member named 'pb'
  180 |      D.pb(z[j].s);
      |        ^~
rail.cpp:180:16: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  180 |      D.pb(z[j].s);
      |                ^
rail.cpp:182:28: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  182 |       R = pos2, Rid = z[j].s;
      |                            ^
rail.cpp:186:6: error: expected ';' before 'd1'
  186 |    ll d1 = get(Lid, z[j].s);
      |      ^~~
      |      ;
rail.cpp:187:6: error: expected ';' before 'd2'
  187 |    ll d2 = get(Rid, z[j].s);
      |      ^~~
      |      ;
rail.cpp:188:6: error: expected ';' before 'pos1'
  188 |    ll pos1 = L + d1;// type D
      |      ^~~~~
      |      ;
rail.cpp:189:6: error: expected ';' before 'pos2'
  189 |    ll pos2 = R - d2;// type C
      |      ^~~~~
      |      ;
rail.cpp:191:7: error: 'pos1' was not declared in this scope
  191 |    if(pos1 < R) {
      |       ^~~~
rail.cpp:193:75: error: 'd2' was not declared in this scope
  193 |      if(location[u] < pos1 && (pos1 - location[u]) + (R - location[u]) == d2)
      |                                                                           ^~
rail.cpp:197:20: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  197 |      location[z[j].s] = pos1;
      |                    ^
rail.cpp:198:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  198 |      stype[z[j].s] = 2;
      |                 ^
rail.cpp:199:8: error: 'class std::vector<int>' has no member named 'pb'
  199 |      D.pb(z[j].s);
      |        ^~
rail.cpp:199:16: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  199 |      D.pb(z[j].s);
      |                ^
rail.cpp:202:21: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  202 |       location[z[j].s] = pos2;
      |                     ^
rail.cpp:202:26: error: 'pos2' was not declared in this scope
  202 |       location[z[j].s] = pos2;
      |                          ^~~~
rail.cpp:203:18: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  203 |       stype[z[j].s] = 1;
      |                  ^
rail.cpp:204:9: error: 'class std::vector<int>' has no member named 'pb'
  204 |       C.pb(z[j].s);
      |         ^~
rail.cpp:204:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  204 |       C.pb(z[j].s);
      |                 ^
rail.cpp:208:7: error: 'pos2' was not declared in this scope
  208 |    if(pos2 > L) {
      |       ^~~~
rail.cpp:208:14: error: 'L' was not declared in this scope
  208 |    if(pos2 > L) {
      |              ^
rail.cpp:210:75: error: 'd1' was not declared in this scope; did you mean 'y1'?
  210 |      if(location[u] > pos2 && (location[u] - pos2) + (location[u] - L) == d1)
      |                                                                           ^~
      |                                                                           y1
rail.cpp:214:21: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  214 |       location[z[j].s] = pos2;
      |                     ^
rail.cpp:215:18: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  215 |       stype[z[j].s] = 1;
      |                  ^
rail.cpp:216:9: error: 'class std::vector<int>' has no member named 'pb'
  216 |       C.pb(z[j].s);
      |         ^~
rail.cpp:216:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  216 |       C.pb(z[j].s);
      |                 ^
rail.cpp:219:20: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  219 |      location[z[j].s] = pos1;
      |                    ^
rail.cpp:219:25: error: 'pos1' was not declared in this scope
  219 |      location[z[j].s] = pos1;
      |                         ^~~~
rail.cpp:220:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  220 |      stype[z[j].s] = 2;
      |                 ^
rail.cpp:221:8: error: 'class std::vector<int>' has no member named 'pb'
  221 |      D.pb(z[j].s);
      |        ^~
rail.cpp:221:16: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  221 |      D.pb(z[j].s);
      |                ^
rail.cpp:225:21: error: 'L' was not declared in this scope
  225 |    if(location[0] - L + dist[0][z[j].s] == d1) {
      |                     ^
rail.cpp:225:38: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  225 |    if(location[0] - L + dist[0][z[j].s] == d1) {
      |                                      ^
rail.cpp:225:44: error: 'd1' was not declared in this scope; did you mean 'y1'?
  225 |    if(location[0] - L + dist[0][z[j].s] == d1) {
      |                                            ^~
      |                                            y1
rail.cpp:226:28: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  226 |     if(d1 - (location[z[0].s] - L) + (R - location[z[0].s]) == d2) {
      |                            ^
rail.cpp:226:57: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  226 |     if(d1 - (location[z[0].s] - L) + (R - location[z[0].s]) == d2) {
      |                                                         ^
rail.cpp:226:64: error: 'd2' was not declared in this scope
  226 |     if(d1 - (location[z[0].s] - L) + (R - location[z[0].s]) == d2) {
      |                                                                ^~
rail.cpp:227:20: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  227 |      location[z[j].s] = pos1;
      |                    ^
rail.cpp:227:25: error: 'pos1' was not declared in this scope
  227 |      location[z[j].s] = pos1;
      |                         ^~~~
rail.cpp:228:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  228 |      stype[z[j].s] = 2;
      |                 ^
rail.cpp:229:8: error: 'class std::vector<int>' has no member named 'pb'
  229 |      D.pb(z[j].s);
      |        ^~
rail.cpp:229:16: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  229 |      D.pb(z[j].s);
      |                ^
rail.cpp:231:20: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  231 |      location[z[j].s] = pos2;
      |                    ^
rail.cpp:231:25: error: 'pos2' was not declared in this scope
  231 |      location[z[j].s] = pos2;
      |                         ^~~~
rail.cpp:232:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
  232 |      stype[z[j].s] = 1;
      |                 ^
rail.cpp: