제출 #990895

#제출 시각아이디문제언어결과실행 시간메모리
990895tincamateiAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
118 ms14164 KiB
#include <bits/stdc++.h> bool eats(std::pair<int, int> eater, std::pair<int, int> eaten) { int dist = std::abs(eater.first - eaten.first); return dist <= eater.second - eaten.second; } int main() { std::cin.tie(NULL); std::iostream::sync_with_stdio(false); int N; std::cin >> N; std::vector<std::pair<int, int>> input(N); for (int i = 0; i < N; i++) { int X, E; std::cin >> X >> E; input[i] = {X - E, X + E}; } std::sort(input.begin(), input.end(), [](const std::pair<int, int> a, const std::pair<int, int> b) { return a.first < b.first || (a.first == b.first && a.second > b.second); }); const int INF = 1000000000; std::pair<int, int> last = {-INF - 1, -INF - 1}; int res = 0; for (int i = 0; i < input.size(); i++) { auto [L, R] = input[i]; // otherwise this is eaten if (R > last.second) { res++; last = {L, R}; } } std::cout << res; return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:33:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for (int i = 0; i < input.size(); i++) {
      |                     ~~^~~~~~~~~~~~~~
Main.cpp:34:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   34 |         auto [L, R] = input[i];
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...