Submission #224952

#TimeUsernameProblemLanguageResultExecution timeMemory
224952kartelKonj (COCI19_konj)C++14
7 / 70
66 ms5112 KiB
#include <bits/stdc++.h> #define in(x) freopen(x,"r",stdin) #define out(x) freopen(x,"w",stdout) #define F first #define S second #define pb push_back #define M ll(998244353) #define inf ll(2e9+7) #define N ll(200500) #define sz(x) x.size() //#pragma GCC optimize("unroll-loops") //#pragma GCC optimize("O3") //#pragma GCC optimize("Ofast") #define el '\n' using namespace std; typedef unsigned long long ull; typedef long long ll; typedef long double ld; //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //using namespace __gnu_pbds; //typedef tree <ll, null_type, less_equal <ll>, rb_tree_tag, tree_order_statistics_node_update> os; char ans[301][301]; int a[301][301]; int xl[N], xr[N], yl[N], yr[N], pr[N], ra[N], i, j, x, y, k, n, n1, m1; int f(int x) {return ((pr[x] == x) ? x : (pr[x] = f(pr[x])));} void link(int x, int y) { x = f(x); y = f(y); if (x > y) swap(x, y); if (ra[x] < ra[y]) pr[x] = y; else { pr[y] = x; if (ra[x] == ra[y]) ra[y]++; } } int main() { // in("input.txt"); // out("output.txt"); ios_base::sync_with_stdio(false); iostream::sync_with_stdio(false); cin.tie(NULL); cin >> n; for (i = 1; i <= n; i++) pr[i] = i, ra[i] = 1; for (i = 1; i <= n; i++) { cin >> xl[i] >> yl[i] >> xr[i] >> yr[i]; if (xl[i] > xr[i]) swap(xl[i], xr[i]); if (yl[i] > yr[i]) swap(yl[i], yr[i]); for (x = xl[i]; x <= xr[i]; x++) for (y = yl[i]; y <= yr[i]; y++) { if (a[x][y] == 0) a[x][y] = i; else link(a[x][y], i); } } for (i = 0; i <= 300; i++) for (j = 0; j <= 300; j++) ans[i][j] = '.'; cin >> x >> y; k = a[x][y]; for (i = 1; i <= n; i++) { if (f(i) != f(k)) continue; n1 = max(n1, xr[i]); m1 = max(m1, yr[i]); for (x = xl[i]; x <= xr[i]; x++) for (y = yl[i]; y <= yr[i]; y++) ans[y][x] = '#'; } int f = 0; for (i = m1; i >= 0; i--) { for (j = 0; j <= n1; j++) cout << ans[i][j]; cout << el; } }

Compilation message (stderr)

konj.cpp: In function 'int main()':
konj.cpp:91:9: warning: unused variable 'f' [-Wunused-variable]
     int f = 0;
         ^
#Verdict Execution timeMemoryGrader output
Fetching results...