Submission #995558

#TimeUsernameProblemLanguageResultExecution timeMemory
995558dreamboyPalembang Bridges (APIO15_bridge)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> using namespace std; //using namespace __gnu_pbds; #define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define russian setlocale(LC_ALL,"Russian_Russia.20866"); #define file freopen("onlyone.in", "r", stdin), freopen("onlyone.out", "w", stdout); #define ll long long #define ull unsigned long long #define ld long double #define pll pair<ll, ll> #define pii pair<int, int> #define all(s) s.begin(), s.end() #define pb push_back #define ins insert #define mp make_pair #define sz(x) x.size() #define F first #define S second #define lb lower_bound #define ub upper_bound #define mem(x) memset(x, 0, sizeof(x)) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const ll N = 30010; const ll M = 600000; const ll block = 316; const ll mod = 998244353; const ll P = 263; const ld pi = acos(-1); const ll inf = 1e9; ll add(ll a, ll b) { if(a + b < 0) return a + b + mod; if(a + b >= mod) return a + b - mod; return a + b; } ll sub(ll a, ll b) { return (a - b + mod) % mod; } ll mul(ll a, ll b) { return a * 1LL * b % mod; } ll binpow(ll a, ll n) { ll res = 1LL; while(n) { if(n & 1) res = mul(res, a); // if(n % 2 == 1) a = mul(a, a); n >>= 1; //n / 2 } return res; } ll inv(ll x) {//число х в степени -1 return binpow(x, mod - 2); } ll k, n; set<ll> s; void solve() { cin >> k >> n; ll delt = 0LL; vector<pll> v; for(ll i = 1; i <= n; i++) { char a, b; ll x, y; cin >> a >> x >> b >> y; if(a == b) delt += abs(x - y);        else {       v.pb({x, y}); }      s.insert(x); s.insert(y);   } if(k == 1) { ll ans = LLONG_MAX; for (auto to: s) { ll cur = 0LL; for (auto [x, y]: v) { cur += abs(to - x) + abs(to - y) + 1LL; } ans = min(ans, cur); } cout << ans + delt << '\n'; } } signed main() { speed; //file; int test = 1; //cin >> test; while(test--) { solve(); } }

Compilation message (stderr)

bridge.cpp:72:2: error: extended character   is not valid in an identifier
   72 |         else {
      |  ^
bridge.cpp:72:5: error: extended character   is not valid in an identifier
   72 |         else {
      |    ^
bridge.cpp:72:8: error: extended character   is not valid in an identifier
   72 |         else {
      |      ^
bridge.cpp:72:11: error: extended character   is not valid in an identifier
   72 |         else {
      |        ^
bridge.cpp:73:2: error: extended character   is not valid in an identifier
   73 |       
      |  ^
bridge.cpp:73:5: error: extended character   is not valid in an identifier
   73 |       
      |    ^
bridge.cpp:73:8: error: extended character   is not valid in an identifier
   73 |       
      |      ^
bridge.cpp:76:2: error: extended character   is not valid in an identifier
   76 |       s.insert(x); s.insert(y);
      |  ^
bridge.cpp:76:5: error: extended character   is not valid in an identifier
   76 |       s.insert(x); s.insert(y);
      |    ^
bridge.cpp:76:8: error: extended character   is not valid in an identifier
   76 |       s.insert(x); s.insert(y);
      |      ^
bridge.cpp:77:2: error: extended character   is not valid in an identifier
   77 |     }
      |  ^
bridge.cpp: In function 'void solve()':
bridge.cpp:72:2: error: '\U000000a0' was not declared in this scope
   72 |         else {
      |  ^
bridge.cpp:76:4: error: expected ';' before '\U000000a0'
   76 |       s.insert(x); s.insert(y);
      |   ^~
      |   ;
bridge.cpp:77:4: error: expected ';' before '}' token
   77 |     }
      |   ^ ~
      |   ;