제출 #633274

#제출 시각아이디문제언어결과실행 시간메모리
633274ieeSunčanje (COCI18_suncanje)C++17
130 / 130
1477 ms193776 KiB
// iee #include <bits/stdc++.h> #pragma GCC optimize("Ofast") using ll = long long; using ull = unsigned long long; using pii = std::pair<int,int>; using db = double; using ld = long double; #define py puts("YES") #define pn puts("NO") #define pf puts("-1") #define hh puts("") #define fi first #define se second #define mkp make_pair #define re =RD() #define rd RD() #define debug(...) fprintf(stderr,__VA_ARGS__) #define all(x) (x).begin(),(x).end() #define pb push_back #define eb emplace_back #define ep emplace #define ci const int #define vi vector<int> #define fn for(int i=1;i<=n;++i) #define rept(t) for(int I=t;I-->0;) #define rep(stO,a,b) for(int stO=(a);stO<=(b);stO++) #define Rep(stO,a,b) for(int stO=(a);stO<(b);stO++) #define per(Orz,a,b) for(int Orz=(a);Orz>=(b);Orz--) #define ina int n,a[N]; #define rna n=RD();fn a[i]=RD(); using namespace std; void big(int &x,int y){if(y>x)x=y;}void sml(int &x,int y){if(y<x)x=y;} int qpow(int a, int b, int p) { int res = 1 % p; while (b) { if (b % 2) res = 1ll * res * a % p; a = 1ll * a * a % p; b /= 2; } return res; } int RD() { int x = 0, f = 1, ch = getchar(); while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + (ch - '0'); ch = getchar(); } return x * f; } //ci p = 998244353 1000000007; int fac[N], inv[N], ifac[N]; int binom(int x, int y, int MOD = p) { if (x < y) return 0; return 1ll * fac[x] * ifac[y] % p * ifac[x - y] % p; } void init(int LIM = N - 1, int MOD = p) { fac[0] = ifac[0] = inv[1] = 1; rep(i, 1, LIM) fac[i] = 1ll * fac[i - 1] * i % MOD; rep(i, 2, LIM) inv[i] = 1ll * (MOD - MOD / i) * inv[MOD % i] % MOD; rep(i, 1, LIM) ifac[i] = 1ll * ifac[i - 1] * inv[i] % MOD; } void work(int); signed main() { int CASINPUT = 1; string op = R"( )";if (op.size() == 19) cin >> CASINPUT; rep(CUR, 1, CASINPUT) work(CUR); } #define x1 jioejwrojoirjw #define x2 jrioewjrojweoirj #define y1 fjewjriowejorje #define y2 rweojroiwejroihjw ci N = 1e6 + 5; int n, x1[N], y1[N], x2[N], y2[N]; int ans[N]; int lshx[N], lshy[N], tx, ty; int calcx(int x) { return lower_bound(lshx + 1, lshx + tx + 1, x) - lshx; } int calcy(int y) { return lower_bound(lshy + 1, lshy + ty + 1, y) - lshy; } set<pii> lz[N], tr[N]; bool nc(set<pii> &s, int l, int r) { //未覆盖 if (s.empty()) return 1; auto il = s.lower_bound(mkp(l, 0)); if (il != end(s) && il->fi <= r) return 0; if (il != begin(s) && prev(il)->se >= l) return 0; return 1; } void addy(set<pii> &s, int l, int r) { if (s.empty()) { s.ep(l, r); return; } auto il = s.upper_bound(mkp(l, 0)), ir = s.upper_bound(mkp(r, 1e18)); if (il != begin(s)) { --il; if (il->se < l) ++il; } vector<pii> del; while (il != ir) del.eb(*il), l = min(l, il->fi), r = max(r, il->se), il++; for (auto it: del) s.erase(it); s.ep(l, r); } bool addx(int u, int l, int r, int ql, int qr, int yl, int yr) { bool res = nc(tr[u], yl, yr); if (l >= ql && r <= qr) { res &= nc(lz[u], yl, yr); addy(lz[u], yl, yr); addy(tr[u], yl, yr); return res; } addy(lz[u], yl, yr); int mid = l + r >> 1; if (ql <= mid) res &= addx(u << 1, l, mid, ql, qr, yl, yr); if (qr > mid) res &= addx(u << 1 | 1, mid + 1, r, ql, qr, yl, yr); return res; } void work(int CASE) { n re; fn{ int x re, y re, a re, b re; x1[i] = x; x2[i] = x + a - 1; y1[i] = y; y2[i] = y + b - 1; } fn lshx[++tx] = x1[i], lshx[++tx] = x2[i]; fn lshy[++ty] = y1[i], lshy[++ty] = y2[i]; sort(lshx + 1, lshx + tx + 1); sort(lshy + 1, lshy + ty + 1); tx = unique(lshx + 1, lshx + tx + 1) - lshx - 1; ty = unique(lshy + 1, lshy + ty + 1) - lshy - 1; fn { x1[i] = calcx(x1[i]); x2[i] = calcx(x2[i]); y1[i] = calcy(y1[i]); y2[i] = calcy(y2[i]); } per(i,n,1) ans[i] = addx(1, 1, tx, x1[i], x2[i], y1[i], y2[i]); fn if(ans[i]) puts("DA"); else puts("NE"); }

컴파일 시 표준 에러 (stderr) 메시지

suncanje.cpp: In function 'bool addx(int, int, int, int, int, int, int)':
suncanje.cpp:81:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   81 |  int mid = l + r >> 1;
      |            ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...