제출 #41323

#제출 시각아이디문제언어결과실행 시간메모리
41323wzy거래 (IZhO13_trading)C++11
0 / 100
1378 ms65536 KiB
#include <bits/stdc++.h> using namespace std; #define pii pair<int,int> #define F first #define pb push_back #define S second int n , m , carry[1000005]; vector<pii> st [1000005], ed[1000005]; multiset<pii> ans; int main(){ scanf("%d%d" , &n , &m); for(int i = 0 ; i < m ; i++){ int l ,r , v; scanf("%d%d%d" , &l , &r , &v); st[l].pb(pii(r, v)); } for(int i = 0 ; i <= n ; i++) carry[i] = 0; for(int i = 1 ; i <= n ; i++){ while(!st[i].empty()){ ans.insert(pii(i -st[i].back().S , st[i].back().F)); ed[st[i].back().F].pb(pii(pii( i - st[i].back().S , st[i].back().F))); st[i].pop_back(); } if(!ans.empty()){ pii u = *ans.begin(); carry[i] = max(carry[i] , i - u.F); } while(ed[i].size()){ ans.erase(ans.find(ed[i].back())); ed[i].pop_back(); } } for(int i = 1 ; i <= n; i++) printf("%d " , carry[i]); }

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

trading.cpp: In function 'int main()':
trading.cpp:13:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d" , &n , &m);
                         ^
trading.cpp:16:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d" , &l , &r , &v);
                                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...