제출 #348061

#제출 시각아이디문제언어결과실행 시간메모리
348061shrek12357사다리꼴 (balkan11_trapezoid)C++14
2 / 100
356 ms21448 KiB
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #include <set> #include <climits> #include <cmath> #include <fstream> #include <queue> #include <stack> #include <iomanip> #include <bitset> //#include "molecules.h" using namespace std; #define ll long long //cin.tie(0);ios_base::sync_with_stdio(0); struct s { int x, y, x1, y1; }; bool comp(s a, s b) { return min(a.x, a.x1) < min(b.x, b.x1); } const int MAXN = 1e5 + 5; int BIT[MAXN]; void update(int idx, int val) { for (; idx < MAXN; idx += idx & -idx) { BIT[idx] = max(BIT[idx], val); } } int query(int idx) { int ret = 0; for (; idx > 0; idx -= idx & -idx) { ret = max(ret, BIT[idx]); } return ret; } int dp[MAXN]; ll ways[MAXN]; const int MOD = 30013; int main() { int n; cin >> n; vector<pair<pair<int, int>, pair<int, int>>> nums; map<int, int> cc; vector<int> p; for (int i = 0; i < n; i++) { int a, b, c, d; cin >> a >> b >> c >> d; p.push_back(a); p.push_back(b); p.push_back(c); p.push_back(d); nums.push_back({ {a, c}, {i, 1} }); nums.push_back({ {b, d}, {i, 2} }); } sort(p.begin(), p.end()); sort(nums.begin(), nums.end()); int cnt = 1; for (int i = 0; i < p.size(); i++) { if (cc.find(p[i]) != cc.end()) { continue; } cc[p[i]] = cnt; cnt++; } int ans = 0; for (int i = 0; i < nums.size(); i++) { if (nums[i].second.second == 1) { dp[i] = query(cc[nums[i].first.second]); dp[i]++; ans = max(ans, dp[i]); } else { update(cc[nums[i].first.second], dp[nums[i].second.first]); } } cout << ans << " " << 0 << endl; }

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

trapezoid.cpp: In function 'int main()':
trapezoid.cpp:69:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 |  for (int i = 0; i < p.size(); i++) {
      |                  ~~^~~~~~~~~~
trapezoid.cpp:77:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<int, int>, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |  for (int i = 0; i < nums.size(); i++) {
      |                  ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...