제출 #495288

#제출 시각아이디문제언어결과실행 시간메모리
495288reni거래 (IZhO13_trading)C++14
100 / 100
505 ms36516 KiB
#include<iostream> #pragma GCC optimize ("O3") #include<vector> #include<set> using namespace std; multiset<long long>s; vector<long long>v1[300002],v2[300002]; int main() { long long i,j,n,m,l,r,x; cin>>n>>m; for(i=1;i<=m;i++) { cin>>l>>r>>x; v1[l].push_back(x-l); v2[r].push_back(x-l); } for(i=1;i<=n;i++) { for(j=0;j<v1[i].size();j++)s.insert(v1[i][j]); if(s.empty()) { cout<<0<<" "; } else { auto it=s.end();it--; cout<<*it+i<<" "; } for(j=0;j<v2[i].size();j++)s.erase(s.find(v2[i][j])); } cout<<endl; }

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

trading.cpp: In function 'int main()':
trading.cpp:24:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         for(j=0;j<v1[i].size();j++)s.insert(v1[i][j]);
      |                 ~^~~~~~~~~~~~~
trading.cpp:37:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         for(j=0;j<v2[i].size();j++)s.erase(s.find(v2[i][j]));
      |                 ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...