제출 #418496

#제출 시각아이디문제언어결과실행 시간메모리
418496johuthaRectangles (IOI19_rect)C++17
0 / 100
567 ms22812 KiB
#include "rect.h" #include <bits/stdc++.h> using namespace std; vector<int> tree; void update(int v, int rl, int rr, int pos, int x) { if (rl == rr) { tree[v] = x; return; } int rm = (rl + rr)/2; if (pos <= rm) update(v*2, rl, rm, pos, x); else update(v*2+1, rm+1, rr, pos, x); tree[v] = max(tree[v*2], tree[v*2+1]); } int querry(int v, int rl, int rr, int ql, int qr) { if (ql > qr) return 0; if (rl == ql && rr == qr) { return tree[v]; } int rm = (rl + rr) / 2; return max(querry(v*2, rl, rm, ql, min(qr, rm)), querry(v*2+1, rm+1, rr, max(rm+1, ql), qr)); } long long count_rectangles(std::vector<std::vector<int> > a) { vector<bool> topBottom; tree.assign(a[1].size()*4, 0); int res = 0; for (int i = 0; i<a[1].size(); i++) { topBottom.push_back(a[1][i] < a[0][i] && a[1][i] < a[2][i]); update(1, 0, a[1].size()-1, i, a[1][i]); } for (int i = 1; i<a[1].size()-1; i++) { for (int j = i; j<a[1].size()-1; j++) { if (querry(1, 0, a[1].size()-1, i, j) < min(a[1][i-1], a[1][j+1])) { res++;} } } return res; }

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

rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:43:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |  for (int i = 0; i<a[1].size(); i++) {
      |                  ~^~~~~~~~~~~~
rect.cpp:48:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |  for (int i = 1; i<a[1].size()-1; i++) {
      |                  ~^~~~~~~~~~~~~~
rect.cpp:49:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |   for (int j = i; j<a[1].size()-1; j++) {
      |                   ~^~~~~~~~~~~~~~
#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...