Submission #552226

#TimeUsernameProblemLanguageResultExecution timeMemory
552226PiejanVDCSky Walking (IOI19_walk)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #include "walk.h" long long min_distance(std::vector<int> x, std::vector<int> h, std::vector<int> l, std::vector<int> r, std::vector<int> y, int s, int g) { const long long n = (long long)x.size(); const long long m = (long long)l.size(); vector<set<long long>>v(n); v[g].insert(0); set<pair<long long,pair<long long,long long>>>connected; for(long long i = 0 ; i < m ; i++) { for(long long ii = l[i] ; ii <= r[i] ; ii++) { if(ii < r[i]) connected.insert({y[i], {ii, ii+1}}); v[ii].insert(y[i]); } } map<pair<long long,long long>,long long>dist; priority_queue<pair<long long,pair<long long,long long>>>pq; pq.push({0,{s,0}}); while(!pq.empty()) { auto node = pq.top(); pq.pop(); auto [i,y] = node.second; if(i > 0 && v[i-1].count(y) && connected.count({y, {i-1,i}})) { if((!dist.count({i-1,y}) || dist[{i,y}] + i - x[i-1] < dist[{i-1,y}])) { dist[{i-1,y}] = dist[{i,y}] + x[i] - x[i-1]; pq.push({-dist[{i-1,y}], {i-1, y}}); } } if(i < n-1 && v[i+1].count(y) && connected.count({y, {i,i+1}})) { if((!dist.count({i+1,y}) || dist[{i,y}] + x[i+1] - i < dist[{i+1,y}])) { dist[{i+1,y}] = dist[{i,y}] + x[i+1] - x[i]; pq.push({-dist[{i+1,y}], {i+1, y}}); } } for(auto it = v[i].begin() ; it != v[i].end() ; it++) { long long yy = *it; if(yy > h[i] || y > h[i]) break;            if(!dist.count({i,yy}) || dist[{i,y}] + abs(y - yy) < dist[{i,yy}]) { dist[{i,yy}] = dist[{i,y}] + abs(y - yy); pq.push({-dist[{i,yy}], {i, yy}}); } } } if(!dist.count({g,0})) return -1; return dist[{g,0}]; }

Compilation message (stderr)

walk.cpp:49:2: error: extended character   is not valid in an identifier
   49 |             if(!dist.count({i,yy}) || dist[{i,y}] + abs(y - yy) < dist[{i,yy}]) {
      |  ^
walk.cpp:49:5: error: extended character   is not valid in an identifier
   49 |             if(!dist.count({i,yy}) || dist[{i,y}] + abs(y - yy) < dist[{i,yy}]) {
      |    ^
walk.cpp:49:8: error: extended character   is not valid in an identifier
   49 |             if(!dist.count({i,yy}) || dist[{i,y}] + abs(y - yy) < dist[{i,yy}]) {
      |      ^
walk.cpp:49:11: error: extended character   is not valid in an identifier
   49 |             if(!dist.count({i,yy}) || dist[{i,y}] + abs(y - yy) < dist[{i,yy}]) {
      |        ^
walk.cpp:49:14: error: extended character   is not valid in an identifier
   49 |             if(!dist.count({i,yy}) || dist[{i,y}] + abs(y - yy) < dist[{i,yy}]) {
      |          ^
walk.cpp:49:17: error: extended character   is not valid in an identifier
   49 |             if(!dist.count({i,yy}) || dist[{i,y}] + abs(y - yy) < dist[{i,yy}]) {
      |            ^
walk.cpp: In function 'long long int min_distance(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, int, int)':
walk.cpp:49:2: error: '\U000000a0' was not declared in this scope
   49 |             if(!dist.count({i,yy}) || dist[{i,y}] + abs(y - yy) < dist[{i,yy}]) {
      |  ^
walk.cpp:49:40: error: expected primary-expression before ')' token
   49 |             if(!dist.count({i,yy}) || dist[{i,y}] + abs(y - yy) < dist[{i,yy}]) {
      |                                  ^
walk.cpp:49:55: error: expected primary-expression before ']' token
   49 |             if(!dist.count({i,yy}) || dist[{i,y}] + abs(y - yy) < dist[{i,yy}]) {
      |                                                 ^
walk.cpp:49:84: error: expected primary-expression before ']' token
   49 |             if(!dist.count({i,yy}) || dist[{i,y}] + abs(y - yy) < dist[{i,yy}]) {
      |                                                                              ^