제출 #90894

#제출 시각아이디문제언어결과실행 시간메모리
90894Hideo거래 (IZhO13_trading)C++14
100 / 100
250 ms11496 KiB
#include <bits/stdc++.h> using namespace std; #define mk make_pair #define pb push_back const int N = 3e5 + 7; const int INF = 1e9 + 7; int lar[N], rar[N], xar[N], ans[N]; int t[4 * N]; int n, m, cx, id; vector < pair < int , int > > v; void upd (int v, int l, int r, int ql, int qr){ if (t[v] == r - l + 1 || (qr < l || r < ql)) return; else if (r == l){ ans[l] = cx + l; t[v] = 1; return; } int mid = (l + r) / 2; upd(v + v, l, mid, ql, qr); upd(v + v + 1, mid + 1, r, ql, qr); t[v] = t[v + v] + t[v + v + 1]; } main(){ cin >> n >> m; for (int i = 1; i <= m; i++){ scanf("%d%d%d", &lar[i], &rar[i], &xar[i]); v.pb(mk(xar[i] - lar[i], i)); } sort (v.begin(), v.end()); while (!v.empty()){ id = v.back().second, cx = v.back().first; v.pop_back(); upd(1, 1, n, lar[id], rar[id]); } for (int i = 1; i <= n; i++){ printf("%d ", ans[i]); } }

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

trading.cpp:29:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
trading.cpp: In function 'int main()':
trading.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d", &lar[i], &rar[i], &xar[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...