Submission #415025

#TimeUsernameProblemLanguageResultExecution timeMemory
415025CollypsoIdeal city (IOI12_city)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define ld long double #define pii pair<int, int> #define pll pair<ll, ll> #define vt vector #define pb push_back #define all(x) (x).begin(), (x).end() #define sz(x) (int) (x).size() #pragma GCC optimize ("O3") #pragma GCC optimize ("O2") #define F first #define S second //#define endl '\n' //#define int long long #include "city.h" const int MOD = 1e9; using namespace std; map<pii, bool> filled; map<pii, int> dist; int bfs(pii start, int i) { dist.clear(); for(auto x : filled) if (x.S) dist[x.F] = INT_MAX; queue<pii> q; q.push(start); dist[start] = 0; while(!q.empty()) { pii v = q.front(); q.pop(); int d = dist[{v.F, v.S}]; if (filled[{v.F + 1, v.S}]) { if (dist[{v.F + 1, v.S}] > d + 1) q.push({v.F + 1, v.S}), dist[{v.F + 1, v.S}] = d + 1; } if (filled[{v.F, v.S + 1}]) { if (dist[{v.F, v.S + 1}] > d + 1) q.push({v.F, v.S + 1}), dist[{v.F, v.S + 1}] = d + 1; } if (filled[{v.F - 1, v.S}]) { if (dist[{v.F - 1, v.S}] > d + 1) q.push({v.F - 1, v.S}), dist[{v.F - 1, v.S}] = d + 1; } if (filled[{v.F, v.S - 1}]) { if (dist[{v.F, v.S - 1}] > d + 1) q.push({v.F, v.S - 1}), dist[{v.F, v.S - 1}] = d + 1; } } int ans = 0; int j = 0; for(auto x : dist) { if (j > i) ans = (1ll * ans + x.S) % MOD; j++; } return ans; } int subtask12(int N, int* X, int* Y) { for(int i = 0; i < N; i++) filled[{*(X + i), *(Y + i)}] = 1; int ans = 0; for(int i = 0; i < N; i++) ans = (1ll * ans + bfs({*(X + i), *(Y + i)}, i)) % MOD; return ans; } int DistanceSum(int N, int* X, int* Y) { if (N <= 2000) return subtask12(N, X, Y); } /* 11 2 5 2 6 3 3 3 6 4 3 4 4 4 5 4 6 5 3 5 4 5 6 */

Compilation message (stderr)

city.cpp:17:10: fatal error: city.h: No such file or directory
   17 | #include "city.h"
      |          ^~~~~~~~
compilation terminated.