제출 #672972

#제출 시각아이디문제언어결과실행 시간메모리
672972Cutebol거래 (IZhO13_trading)C++17
0 / 100
1 ms276 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 = 2e5 + 5 ; const int mod = 1e9 + 7 ; const int inf = 1e12 ; int n , m ; set < pair <int , int> , greater<pair <int , int> > > cur ; vector <pair <int , pair <int , int> > >st ; vector <int> ans ; void solve(){ cin >> n >> m ; for ( int i = 0 ; i < m ; i ++ ){ int x , y , v ; cin >> x >> y >> v ; st.push_back({x,{v,y}}) ; } sort ( st.begin() , st.end() ) ; int ind = 0 ; cur.insert({0,inf}) ; for ( int i = 1 ; i <= n ; i ++ ){ while ( ind < m && st[ind].ff == i ){ cur.insert({st[ind].ss.ff,st[ind].ss.ss}) ; ind ++ ; } pair <int , int> t = *cur.begin() ; ans.push_back(t.ff) ; cur.erase(cur.begin()) ; if ( t.ff != 0 ) t.ff ++ ; cur.insert(t) ; while ( t.ss <= i ){ cur.erase(cur.begin()) ; t = *cur.begin() ; } } 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...