제출 #532434

#제출 시각아이디문제언어결과실행 시간메모리
532434sliviu벽 (IOI14_wall)C++17
0 / 100
1 ms332 KiB
#include "wall.h" #include <bits/stdc++.h> using namespace std; int n, cur = 0; struct node { int omin = 2000000000, omax = 0; }; vector<node> t; vector<int> sol; void Propagate(int node) { t[2 * node].omin = max(t[node].omax, min(t[node].omin, t[2 * node].omin)); t[2 * node].omax = min(t[node].omin, max(t[node].omax, t[2 * node].omax)); t[2 * node + 1].omin = max(t[node].omax, min(t[node].omin, t[2 * node + 1].omin)); t[2 * node + 1].omax = min(t[node].omin, max(t[node].omax, t[2 * node + 1].omax)); t[node].omin = 2000000000, t[node].omax = 0; } void Update(int q, int h, int posleft, int posright, int node = 1, int left = 1, int right = n) { if (posleft <= left && right <= posright) { if (q == 1) { t[node].omax = max(t[node].omax, h); t[node].omin = max(t[node].omin, t[node].omax); } else { t[node].omin = min(t[node].omin, h); t[node].omax = min(t[node].omin, t[node].omax); } return; } Propagate(node); int m = (left + right) / 2; if (posleft <= m) Update(q, h, posleft, posright, 2 * node, left, m); if (posright > m) Update(q, h, posleft, posright, 2 * node + 1, m + 1, right); } void Solve(int node = 1, int left = 1, int right = n) { if (left == right) { sol.emplace_back(min(t[node].omin, t[node].omax)); return; } Propagate(node); int m = (left + right) / 2; Solve(2 * node, left, m); Solve(2 * node + 1, m + 1, right); } void buildWall(int n, int k, int type[], int l[], int r[], int val[], int ans[]) { t = vector<node>(4 * n); //for (int i = 0; i < k; ++i) // Update(type[i], val[i], l[i] + 1, r[i] + 1); //Solve(); assert(sol.size() == n); for (int i = 0; i < n; ++i) ans[i] = sol[i]; }

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

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from wall.cpp:2:
wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:59:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   59 |  assert(sol.size() == n);
      |         ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...