Submission #905220

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9052202024-01-12 18:29:47PetrixAdvertisement 2 (JOI23_ho_t2)C++17
100 / 100
129 ms13924 KiB
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
int ri() {
int n;
scanf("%d", &n);
return n;
}
int main() {
int N = ri();
std::vector<std::pair<int, int> > points(N);
for (int i = 0; i < N; i++) {
int X = ri();
int E = ri();
points[i] = {X - E, X + E}; // {a[i], b[i]}
}
// a巌㷘㷪らbé™·é †ã·«ã·™ã‚‹ã·¨ã€··Œå·Œã·˜ã‚„㷤㷧複数回b㷮最大値を更新㷗㷦㷗㷾㷣㷟り㷗㷪㷷㷪る
std::sort(points.begin(), points.end(), [] (auto &i, auto &j) {
if (i.first != j.first) return i.first < j.first;
return i.second > j.second;
});
int max = -1;
int cnt = 0;
for (auto i : points) if (max < i.second) max = i.second, cnt++;
printf("%d\n", cnt);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

Main.cpp: In function 'int ri()':
Main.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  scanf("%d", &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...