제출 #672975

#제출 시각아이디문제언어결과실행 시간메모리
672975Cutebol거래 (IZhO13_trading)C++17
100 / 100
426 ms35192 KiB
#include <bits/stdc++.h> using namespace std; void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);} #define Scaramouche ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0); #define int long long #define itn int #define endl "\n" #define ff first #define ss second const int N = 3e5 + 5 ; const int mod = 1e9 + 7 ; const int inf = 1e12 ; int n , m ; vector <int> ans ; vector <pair <int , int > > vec[N] ; void solve(){ cin >> n >> m ; for ( int i = 0 ; i < m ; i ++ ){ int x , y , v ; cin >> x >> y >> v ; vec[x].push_back({v-x,0}) ; vec[y+1].push_back({v-x,1}) ; } multiset <int> st ; for ( int i = 1 ; i <= n ; i ++ ){ for ( auto j : vec[i] ){ if ( !j.ss ) st.insert(j.ff) ; else st.erase(st.find(j.ff)) ; } if ( st.empty() ) ans.push_back(0) ; else ans.push_back(*st.rbegin()+i) ; } for ( auto i : ans ) cout << i << ' ' ; } signed main(){ // fopn("blocks") ; // Scaramouche ; int t = 1 ; // cin >> t ; while ( t -- ) solve() ; }

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

trading.cpp: In function 'void fopn(std::string)':
trading.cpp:5:31: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 | void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trading.cpp:5:72: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 | void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                                                                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...