제출 #755617

#제출 시각아이디문제언어결과실행 시간메모리
755617gvancak거래 (IZhO13_trading)C++17
100 / 100
330 ms30888 KiB
#include <bits/stdc++.h> #define ll long long #define s second #define f first using namespace std; ll n,a[300005],sum,x,k,ans,t,ans1,y,z,u,m; bool ok; vector <ll> l[300005],r[300005]; multiset <ll> s; int main(){ ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>m; for (int o=1; o<=m; o++){ cin>>y>>z>>x; l[y].push_back(x-y+1); r[z].push_back(x-y+1); } for (int i=1; i<=n; i++){ for (int j=0; j<l[i].size(); j++){ s.insert(l[i][j]); } if (s.size()==0) { cout<<0<<" "; continue; } set <ll> ::iterator it = s.end(); it--; cout<<(*it)+i-1<<" "; for (int j=0; j<r[i].size(); j++){ s.erase(s.find(r[i][j])); } } cout<<endl; }

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

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