제출 #847788

#제출 시각아이디문제언어결과실행 시간메모리
847788StefanSebezAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
126 ms15716 KiB
#include <bits/stdc++.h> using namespace std; #define fi first #define se second const int inf=1e9+500; pair<int,int>a[500050]; bool nesto(int i,int j) { if(abs(a[i].fi-a[j].fi)<=a[i].se-a[j].se) return true; else return false; } int main() { int n; scanf("%i",&n); for(int i=1;i<=n;i++) { scanf("%i%i",&a[i].fi,&a[i].se); } sort(a+1,a+n+1); vector<int>s; for(int i=1;i<=n;i++) { if(!s.empty() && nesto(s.back(),i)) continue; while(!s.empty() && nesto(i,s.back())) { s.pop_back(); } s.push_back(i); } printf("%i\n",s.size()); return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:31:11: warning: format '%i' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   31 |  printf("%i\n",s.size());
      |          ~^    ~~~~~~~~
      |           |          |
      |           int        std::vector<int>::size_type {aka long unsigned int}
      |          %li
Main.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     scanf("%i",&n);
      |     ~~~~~^~~~~~~~~
Main.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   scanf("%i%i",&a[i].fi,&a[i].se);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...