제출 #1061776

#제출 시각아이디문제언어결과실행 시간메모리
1061776jamesbamberRectangles (IOI19_rect)C++17
62 / 100
1739 ms577140 KiB
#include "rect.h" #include <bits/stdc++.h> #pragma GCC target("avx2") using namespace std; constexpr short LOG = 11; constexpr short smal = -1e4; struct tavola_sparsa{ vector<vector<short>> sp; tavola_sparsa(vector<short> &v){ short n = v.size(); sp.resize(LOG, vector<short>(n)); sp[0] = v; for(int i=1; i<LOG; i++){ for(int j=0; j<=(n - (1<<i)); j++){ sp[i][j] = max(sp[i-1][j], sp[i-1][j + (1 << (i-1))]); } } } tavola_sparsa() {} short query(short l, short r){ short log = 31 - __builtin_clz(r-l); return max(sp[log][l], sp[log][r-(1<<log)]); } }; struct segment2d{ vector<tavola_sparsa> tr; int sz; segment2d(vector<vector<short>> &v){ sz = 1; while(sz < v.size()) sz *= 2; tr.resize(2*sz); int sz2 = v[0].size(); vector<short> ilvuoto(sz2); vector<short> treesus(sz2); for(int i=0; i<v.size(); i++) tr[i+sz] = tavola_sparsa(v[i]); for(int i=v.size(); i<sz; i++) tr[i+sz] = tavola_sparsa(ilvuoto); for(int i=sz; --i;){ for(int j=0; j<sz2; j++) treesus[j] = max(tr[2*i].query(j, j+1), tr[2*i+1].query(j, j+1)); tr[i] = tavola_sparsa(treesus); } } int query(int l, int r, int ql, int qr){ short ans = smal; for(l+=sz, r+=sz; l<r; l>>=1, r>>=1){ if(l & 1) ans = max(ans, tr[l++].query(ql, qr)); if(r & 1) ans = max(ans, tr[--r].query(ql, qr)); } return ans; } }; long long count_rectangles(vector<vector<int>> a) { int n = a.size(); int m = a[0].size(); vector up(n, vector<short>(m, -1)), down(n, vector<short>(m, n)), left(n, vector<short>(m, -1)), right(n, vector<short>(m, m)); //right for(int i=0; i<n; i++){ stack<int> s; for(int j=0; j<m; j++){ while(s.size() and a[i][s.top()] < a[i][j]){ right[i][s.top()] = j; s.pop(); } s.push(j); } } //left for(int i=0; i<n; i++){ stack<int> s; for(int j=m-1; j>=0; j--){ while(s.size() and a[i][s.top()] < a[i][j]){ left[i][s.top()] = j; s.pop(); } s.push(j); } } //up for(int j=0; j<m; j++){ stack<int> s; for(int i=n-1; i>=0; i--){ while(s.size() and a[s.top()][j] < a[i][j]){ up[s.top()][j] = i; s.pop(); } s.push(i); } } //down for(int j=0; j<m; j++){ stack<int> s; for(int i=0; i<n; i++){ while(s.size() and a[s.top()][j] < a[i][j]){ down[s.top()][j] = i; s.pop(); } s.push(i); } } int ans = 0; vector querysus(n, vector<bool>(m, true)); segment2d lesegment(right); for(int i=1; i<n-1; i++){ for(int j=1; j<m-1; j++){ int l = left[i][j], r = right[i][j], u = up[i][j], d = down[i][j]; if(l == -1 or r == m or u == -1 or d == n){ querysus[i][j] = 0; continue; } if(querysus[i][j] and r != lesegment.query(u+1, d, l+1, r)) querysus[i][j] = 0; } } lesegment.~segment2d(); new (&lesegment)segment2d(down); for(int i=1; i<n-1; i++){ for(int j=1; j<m-1; j++){ int l = left[i][j], r = right[i][j], u = up[i][j], d = down[i][j]; if(querysus[i][j] and d != lesegment.query(u+1, d, l+1, r)) querysus[i][j] = 0; } } vector somethingsus(n, vector<short>(m)); for(int i=0; i<n; i++){ for(int j=0; j<m; j++){ somethingsus[i][j] = -left[i][j]; } } lesegment.~segment2d(); new (&lesegment)segment2d(somethingsus); for(int i=1; i<n-1; i++){ for(int j=1; j<m-1; j++){ int l = left[i][j], r = right[i][j], u = up[i][j], d = down[i][j]; if(querysus[i][j] and l != -lesegment.query(u+1, d, l+1, r)) querysus[i][j] = 0; } } for(int i=0; i<n; i++){ for(int j=0; j<m; j++){ somethingsus[i][j] = -up[i][j]; } } lesegment.~segment2d(); new (&lesegment)segment2d(somethingsus); for(int i=1; i<n-1; i++){ for(int j=1; j<m-1; j++){ int l = left[i][j], r = right[i][j], u = up[i][j], d = down[i][j]; if(querysus[i][j] and u != -lesegment.query(u+1, d, l+1, r)) querysus[i][j] = 0; } } vector<array<int, 4>> grind; for(int i=1; i<n-1; i++){ for(int j=1; j<m-1; j++){ int l = left[i][j], r = right[i][j], u = up[i][j], d = down[i][j]; if(querysus[i][j]){ grind.push_back({l, r, u, d}); } } } sort(grind.begin(), grind.end()); return unique(grind.begin(), grind.end()) - grind.begin(); } /* ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣠⣤⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⡴⡖⣻⡟⣛⡛⣿⣿⣿⣿⣻⣿⣿⡟⠛⠳⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣯⣾⣤⣹⣷⣿⣿⡿⣿⡿⣿⣿⣿⣿⣼⣧⣄⣚⠉⠛⠶⢶⣤⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣗⣙⠾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢘⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠿⠿⠛⠛⠛⠛⠿⠿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⣿⣯⡿⠀⠀⠀⠀⠀⠀⠀⠠⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⢀⣀⣄⡀⠀⠀⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⡇⣠⣾⣿⣿⣶⣶⣶⣶⣿⣦⡀⠀⠻⣤⣶⣾⣿⣿⣿⣿⣿⠿⠿⣿⣶⣄⠈⣿⡇⢹⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⠁⡿⠟⣉⣽⣿⣿⣿⣿⣿⣿⡗⠀⠀⢈⣿⣿⣿⣿⣿⣿⣿⣷⣾⣿⣿⣿⣦⣹⡇⣽⣿⣿⣿⣿⣿⣿⣿⠀⣀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⢀⠴⠂⠀⣀⣤⣾⣿⣿⣿⣿⣿⡿⠀⢱⣿⣿⣏⣛⣛⣣⢬⣹⢿⠏⠀⢀⣼⣿⣯⡛⠒⢽⣿⣥⡿⣿⣿⣿⣿⣿⣿⣇⣿⣿⣿⣿⣿⣿⣿⣍⣉⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⣰⣿⠤⣶⣿⠿⣻⣿⣿⣿⣿⣿⣿⡇⠀⠀⠋⠀⠉⠉⠁⠒⠉⠀⠀⡀⠀⠀⢿⣿⣿⠛⠦⠀⠀⢸⡿⠋⠋⠙⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡛⣆⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠈⠉⠉⢡⣰⣥⠾⣿⣿⣿⣿⣿⣿⣿⣿⡅⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡾⠁⠀⠀⢸⡿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣾⣿⣿⣿⣿⡹⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⢀⡕⠽⣾⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣶⣶⣤⣶⣿⣷⣼⣧⡀⠀⠀⠀⠠⠀⢀⣰⣿⣿⣿⣿⣿⣿⣷⣻⣿⣿⣿⣿⣿⣿⢿⣿⣶⠄ ⠀⠀⠀⠀⠀⠀⠀⠀⡞⠀⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⢠⠎⠻⠯⣍⠙⠟⢻⣿⠿⣿⠟⠀⠀⠀⣶⣦⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⠳⣌⢣⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⣡⠖⠙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⠀⠈⠀⢀⣴⣿⠟⠁⢾⣿⣷⣄⡀⡀⠀⠀⠿⠟⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠈⠁⠀⣧ ⠀⠀⠀⠀⠀⠀⠀⣼⠃⠀⠀⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡤⠀⠀⠀⣠⣾⣾⠟⢛⣁⣤⣠⣼⣿⣿⣿⣿⣿⣶⣄⣠⣾⣫⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠙⠷⣦⣾⣿⠟⢿⣿⣿⣿⣿⣿⣿⣿⣿⠘⣷⣱⠀⣼⣿⡯⡿⠾⠛⠛⠛⠛⠛⢻⣿⣿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⠋⠀⠀⣻⣿⣿⣿⣿⣿⣿⣿⣷⣿⣷⠃⢿⡟⠀⠀⠰⣦⣤⣤⣴⣶⣿⣿⣿⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⡶⢿⣷⣦⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠈⠀⠀⠀⠀⠀⠛⠉⠛⠛⠛⠻⣿⢟⣉⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠘⣼⣌⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⣽⣷⡶⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⣿⡇⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣷⣶⣠⣤⣠⣦⡡⣠⣼⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⠦⣽⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣿⣿⣿⣿⠉⡆⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠿⠟⠛⠉⢿⣿⣿⣿⣿⣿⣿⣿⣿⡾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣟⡿⣻⣿⠟⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣠⣤⠴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣟⡛⠁⠘⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⢀⣀⣀⣀⣀⣀⣤⢴⣾⠿⣉⣽⠞⠁⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣻⣿⣿⣿⣿⣿⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⡿⠒⠾⣿⣭⣌⡉⠉⠙⠳⠟⢁⣐⠛⠃⠀⢐⡶⠉⠉⠻⣿⣿⣿⣿⣯⡙⢿⣯⣉⠉⠻⣿⣿⣏⢿⣿⣿⣿⣿⣿⣬⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⣧⢐⡦⣌⠙⢮⡹⠛⢶⣤⣶⣯⣍⢰⠋⠄⠘⠁⠀⠀⠀⠈⠍⠛⠻⢿⣿⣷⣍⡻⣿⣶⣮⣙⠿⢾⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣿⣷⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⣿⣿⠆⣈⠵⠶⠈⢺⡉⠙⠿⣿⣿⣿⣷⡷⠂⠀⠀⠀⠰⣾⡄⢀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⢿⣌⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣍⣽⣿⡜⣆⠳⣯⡲⣤⣀⠀⠀⠀⠀⠀⠀⠀ ⣿⣿⡌⡄⠀⠀⠀⠀⠙⢶⣄⠀⠙⢿⣿⣟⣀⠀⠀⠀⠀⠈⢿⣾⡇⠀⠀⠀⣮⢙⣿⣿⣿⣿⣿⣿⣿⣻⣿⣿⣛⣿⣿⣿⣿⣿⣿⣿⣿⡿⠉⢿⡀⠀⠙⢿⣎⢿⣿⣶⣤⣀⠀⠀⠀ ⣿⣿⣷⡹⠀⠀⠀⠀⠀⠀⠈⠻⢦⣄⡙⢻⣿⣾⣤⡀⠀⠀⠈⢿⣿⡀⠀⠀⠹⣾⠟⣿⣿⣿⣿⣿⣿⣿⡏⣿⣿⣿⣿⣿⣿⣿⠿⡛⠑⠀⠂⠸⡿⠝⠀⠄⢻⣧⢻⣆⠉⡹⠿⣿⡂ ⣿⣿⣿⣏⠁⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢻⣿⣿⣿⣿⣷⣄⣀⠈⣿⣷⣄⠀⠘⠙⠰⢿⣿⣿⣿⣿⣿⣿⣧⣚⣿⣿⣯⡋⠄⠰⢉⡀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣧⢻⣦⠘⡇⠈⠛ ⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠈⠉⠙⠛⠛⠻⠾⣿⣿⣟⣷⠀⠀⢪⠙⢿⣿⣿⢿⣿⣿⠙⢻⣿⣿⠁⠶⠔⠈⢑⠋⠀⠀⠀⠀⠀⡀⠀⠀⢿⣿⣧⣙⠦⢻⡀⠀ ⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⡆⠀⠘⠷⣷⣧⣽⣾⣯⣿⡗⠸⣿⣿⠀⠠⢰⠚⠊⠀⠂⠀⠀⠀⠀⡌⠈⠒⠘⡿⡁⢹⣶⣾⡇⠀ ⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⡇⢀⠀⠀⠸⡏⡿⢷⣜⢿⡇⠀⣿⣿⡀⠆⢀⠀⠂⠀⠀⡀⠀⠀⠂⠀⠀⠀⠀⠀⠀⠀⢿⡿⠁⠀ ⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣆⠀⠀⠀⠁⠀⠀⠙⣿⡇⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠈⠂⠀⠐⠁⠀⠀⠀⠀⠀⠀⢸⠅⠀⠀ ⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠿⣦⡀⠀⠀⠀⠀⠀⠃⣿⠀⣿⣿⡇⢀⠀⠀⠀⠀⠀⠀⠀⠘⠆⠀⠀⠀⠀⠀⠀⠀⡸⣦⠀⢀ ⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣷⡄⠀⣸⣿⡄⠀⡏⠀⢿⢿⡇⠀⠄⠀⠀⠘⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⡄⠀⠀⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⡀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⡀⠀⠀⠙⡽⢣⡜⠐⠹⠆⠁⠀⢺⣿⡇⠀⠀⠀⠀⠀⠀⢡⡂⠐⠀⠂⢤⡀⠈⠀⠀⠀⢀⣿⣿⣿ */

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

rect.cpp: In constructor 'segment2d::segment2d(std::vector<std::vector<short int> >&)':
rect.cpp:36:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<short int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |   while(sz < v.size()) sz *= 2;
      |         ~~~^~~~~~~~~~
rect.cpp:44:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<short int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |   for(int i=0; i<v.size(); i++) tr[i+sz] = tavola_sparsa(v[i]);
      |                ~^~~~~~~~~
rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:117:6: warning: unused variable 'ans' [-Wunused-variable]
  117 |  int ans = 0;
      |      ^~~
#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...