제출 #905218

#제출 시각아이디문제언어결과실행 시간메모리
905218PetrixAdvertisement 2 (JOI23_ho_t2)C++17
10 / 100
361 ms14244 KiB
#include <iostream> #include <algorithm> #include <vector> using namespace std; vector<pair<int,int>> v; bool cmp(pair<int,int> a,pair<int,int> b){ if(a.first!=b.first) return a.first<b.first; return a.second>b.second; } int main() { int n,cnt=0,i,curent=-1,a,b; cin>>n; for(i=0;i<n;i++){ cin>>a>>b; v.push_back({a-b,b+a}); } sort(v.begin(),v.end()); for(i=0;i<v.size();i++){ if(curent<v[i].second){ cnt++;curent=v[i].second; } } cout<<cnt; return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:22:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for(i=0;i<v.size();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...